NAME

WebService::Pandora::Cryptor - Encryption/Decryption for Pandora API

SYNOPSIS

use WebService::Pandora::Cryptor;

$cryptor = WebService::Pandora::Cryptor->new( encryption_key => 'key',
                                              decryption_key => 'key' );

$encrypted = $cryptor->encrypt( "string" );
$decrypted = $cryptor->decrypt( $encrypted );

DESCRIPTION

WebService::Pandora::Cryptor is used to encrypt and decrypt the data sent to and from the Pandora JSON API. Some methods require the JSON to be sent using the Blowfish algorithm in ECB mode. Some of the attributes returned by the API are encrypted and thus need to be decrypted to read. Each WebService::Pandora::Partner uses a different key for encryption and decryption. If the WebService::Pandora::Method object is passed a true value for the encrypt boolean, it uses this module to do so for the submitted JSON data.

CONSTRUCTOR

new

Creates a WebService::Pandora::Cryptor object with the arguments given. The encryption_key and decryption_key options are both required.

$cryptor = WebService::Pandora::Cryptor->new( encryption_key => 'key',
                                              decryption_key => 'key' );

METHODS

encrypt ( STRING ) [required]

Returns a Blowfish ECB hex encrypted string of the JSON data given that the Pandora API expects, using the provided encryption_key specified in the constructor.

$encrypted = $cryptor->encrypt( $json_str );

decrypt ( ENCRYPTED ) [required]

Returns the decrypted string, given a hex encrypted Blowfish ECB string, that the Pandora JSON API may send. Uses the decryption_key specified in the constructor.

$decrypted = $cryptor->decrypt( $encrypted );

error

Returns a string containing a message about why the last method call failed.

SEE ALSO

WebService::Pandora WebService::Pandora::Method Crypt::ECB Crypt::Blowfish

AUTHOR

Mitch McCracken <mrmccrac@gmail.com>