NAME

Chef::Encoder

VERSION

1.1

SYNOPSIS

 use Chef::Encoder;

 my $obj  = new Chef::Encoder
           ( 
             'data'             => $data
           , 'private_key_file' => ../data/private_key.pem
           );
           
    $obj->pki->sign     ( 'data' => $data );
    $obj->sha1->digest  ( 'data' => $data );
    $obj->base64->encode( 'data' => $data );
    $obj->base64->decode( 'data' => $data );
    

DESCRIPTION

This module imiplements methods that perform the encoding and decoding and signing of the header once you load this module it will inturn load three classes

  • Chef::Encode::pki

  • Chef::Encode::sha1

  • Chef::Encode::base64

+----------------+ | Chef::Encode | +---------------------+ | Chef::Encode::pki | +----------------------+ | Chef::Encode::sha1 | +------------------------+ | Chef::Encode::base64 | +------------------------+

METHODS

Chef::Encoder( %params )

return new object initialzied as per %params.

private_key_file

returns $private_key_file

private_key

returns $private_key

data

returns $data

pki ( %params)

loads Chef::Encoder::pki class and returns new object of class Chef::Encoder::pki it accepts ( 'private_key_file' => $private_key_file , 'private_key' => $private_key ) if none is provided it will try to use the values initialized from parent class Chef::Encoder

NAME

Chef::Encoder::pki

VERSION

1.0

DESCRIPTION

This class provides siging request as per private key specified.

METHODS

sign

returns signed data based on the private_key_file or privete_key

sha1 ( %params)

loads Chef::Encoder::sha1 class and returns new object of class Chef::Encoder::sha1 it accepts ( 'data' => $data ) if none is provided it will try to use the values initialized from parent class Chef::Encoder

NAME

Chef::Encoder::sha1

VERSION

1.0

DESCRIPTION

This class provides sha1 digest of the data initialized

METHODS

digest

it accepts data as parameter $obj->digest( 'data' => $data ) returns sha1 digest in binary encoded with base64 of the data passed.

base64 ( %params)

loads Chef::Encoder::base64 class and returns new object of class Chef::Encoder::base64 it accepts ( 'data' => $data ) if none is provided it will try to use the values initialized from parent class Chef::Encoder

NAME

Chef::Encoder::base64

VERSION

1.0

DESCRIPTION

This class provides base64 encoding and ecoding functionality

METHODS

encode

it accepts data as parameter $obj->encode( 'data' => $data ) returns base64 encoded value of data

decode

it accepts data as parameter $obj->decode( 'data' => $data ) returns base64 decoded value of data

KNOWN BUGS

SUPPORT

open a github ticket or email comments to Bhavin Patel <bpatel10@nyit.edu>

COPYRIGHT AND LICENSE

This Software is free to use , licensed under : The Artisic License 2.0 (GPL Compatible)