
http://pastie.org/4128613 On Mon, Jun 18, 2012 at 5:56 PM, Simon Mburu <sgatonye@gmail.com> wrote:
Hello Guys,
I am working on a project that requires data signatures to a server to be signed. Signed data is expected to contain the signed data in Base 64 ASCII I am extracting the private key to sign this data from a pem file used in creating the server certificate that is sent to the validating server to be used for validation I am using the following code to achieve this
use Crypt::OpenSSL::RSA; use MIME::Base64; use Crypt::RSA; my $data = "qwerty"; my $signed = signData($data);
sub signData{ my $data= shift;
my $key_filename = 'path to pem key file'; my $key_text = read_file( $key_filename );
my $rsa_key = Crypt::OpenSSL::RSA->new_private_key($key_text); #$rsa_key->use_pkcs1_padding(); $rsa_key->use_no_padding(); my $bin_signature = $rsa_key->sign($data);
my $signed = encode_base64($bin_signature); return $signed; }
When I send this data to the server I am still getting an error of the signed data not being valid. Am I signing the data in the correct way?
-- Simon Gatonye
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke