
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

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

Thanks Laban, Seems there aren't many takers on this question. I have noticed our solutions are pretty much the same except for the fact that you are using md5 to hash and I am using pkcs1 padding, and also you are signing data from a file. I am still facing problems with the verification server and I have started to suspect that the issue could be with them. On Fri, Jun 22, 2012 at 12:17 AM, Laban Mwangi <lmwangi@gmail.com> wrote:
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
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
-- Simon Gatonye 0722993642 P.O. Box 75232 Nairobi - 0200
participants (2)
-
Laban Mwangi
-
Simon Mburu