Crypt-Keyczar

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

	- support export RSA public key.
	- independent Digest::SHA1
	- add Crypt::Keyczar::FileWriter.
	- support DSA public key verify.
	- support DSA private key sign.

0.01	Wed Jul 22 20:15:10 JST 2009
	- add "usekey" option.
	- add Java and Python test code.
	- support "revoke".
	- support AES-CBC with HMAC-SHA1 encryption.
	- support HMAC-SHA1 sing/verify.
	- fixed create keyset and ad-key operation.

README  view on Meta::CPAN


SUPPORTED CRYPTOGRAPHIC ALGORITHMS(current version)
---------------------------------------------------
* HMAC
   Default keys are 256 bits. SHA1 used as the hash algorithm.
   HMAC-SHA224, HMAC-SHA256, HMAC-SHA384 and HMAC-SHA512
   algorithms are also supported.

* AES
   Default keys are 128 bits. 192 and 256 bit keys are also
   supported. CBC mode with PKCS#5 padding is used by default.

* RSA Encryption
   RSA-OAEP encryption is used. Default key size is 2048 bits.
   1024, 768, and 512 bit keys are also supported.

* RSA Signatures
   RSA-SHA1 signing is used. Default key size is 2048 bits.
   1024, 768, and 512 bit keys are also supported.

* DSA

lib/Crypt/Keyczar/AesKey.pm  view on Meta::CPAN

package Crypt::Keyczar::AesKey;
use base 'Crypt::Keyczar::Key';
use strict;
use warnings;

use Crypt::Keyczar qw(KEY_HASH_SIZE);
use Crypt::Keyczar::HmacKey;

use constant DEFAULT_MODE => 'CBC';


sub expose {
    my $self = shift;
    my $expose = {};
    $expose->{aesKeyString} = $self->{aesKeyString};
    $expose->{hmacKey} = $self->{hmacKey}->expose;
    $expose->{mode} = $self->{mode};
    $expose->{size} = $self->{size};
    return $expose;

t/crypt.keyczar.aeskey.t  view on Meta::CPAN

use Test::More tests => 14;
use strict;
use warnings;
use Crypt::Keyczar::Util;

BEGIN { use_ok 'Crypt::Keyczar::Key' }

my $key;
$key = Crypt::Keyczar::Key->read_key('AES', q|{"hmacKey": {"hmacKeyString": "9_4wqXs3fyx4VhUCGVN6DelPuuC1XYy-oY2oVxOJ8t0", "size": 256}, "aesKeyString": "lSWq_bw7UIpssD4AvwIEjw", "mode": "CBC", "size": 128}|);
ok($key);
ok($key->get_bytes eq pack 'H*', '9525aafdbc3b508a6cb03e00bf02048f');
ok($key->{size} == 128);
ok($key->{mode} eq 'CBC');
ok($key->{hmacKey}->get_bytes eq pack 'H*', 'f7fe30a97b377f2c7856150219537a0de94fbae0b55d8cbea18da8571389f2dd');
ok($key->{hmacKey}->{hmacKeyString} eq '9_4wqXs3fyx4VhUCGVN6DelPuuC1XYy-oY2oVxOJ8t0');
ok($key->{hmacKey}->{size} == 256);

my $obj = Crypt::Keyczar::Util::decode_json($key->to_string);
ok($obj);
ok($obj->{aesKeyString} eq 'lSWq_bw7UIpssD4AvwIEjw');
ok($obj->{mode} eq 'CBC');
ok($obj->{size} == 128);
ok($obj->{hmacKey}->{hmacKeyString} eq '9_4wqXs3fyx4VhUCGVN6DelPuuC1XYy-oY2oVxOJ8t0');
ok($obj->{hmacKey}->{size} == 256);

t/data/encrypter/1  view on Meta::CPAN

{"hmacKey": {"hmacKeyString": "9_4wqXs3fyx4VhUCGVN6DelPuuC1XYy-oY2oVxOJ8t0", "size": 256}, "aesKeyString": "lSWq_bw7UIpssD4AvwIEjw", "mode": "CBC", "size": 128}

t/data/encrypter/2  view on Meta::CPAN

{"hmacKey": {"hmacKeyString": "vuTYk_M1pM-Xbbei9Xfu3WU1lNI3WlRQzH-a2BBBIX4", "size": 256}, "aesKeyString": "ZK2_TWO77zefTTOcZID_rQ", "mode": "CBC", "size": 128}



( run in 1.274 second using v1.01-cache-2.11-cpan-e1769b4cff6 )