Digital Signatures using Perl

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; use File::Slurp; 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 0722993642 P.O. Box 75232 Nairobi - 0200
participants (1)
-
Simon Mburu