The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CHEF::Encoder

VERSION

1.0

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)