Hello, [EMAIL PROTECTED] wrote on 06/03/2008 04:40:10 AM:
> Dear Sir/Madam, > > I'm currently using Crypt::OpenSSL::RSA module with perl linking with OpenSSL 0.9.8h to > encrypt/decrypt message and transport over HTTP POST request to Java application on the > other side. When Encrypting with the given public key, Java application can receive the > data perfectly. But when Java side encrypt message with private key (which is the pair > for our public key), and reply back, we found the following error while trying to decrypt message: > > RSA.xs:202: OpenSSL error: block type is not 01 at ... > > Please kindly suggest how we could get around this issue. > > Currently, we use PKCS1 padding. Please kindly see below for our perl script used. > > $RSA_Decrypt = Crypt::OpenSSL::RSA->new_public_key( $PublicKey ); > $RSA_Decrypt->use_pkcs1_padding(); > my $TmpText = decode_base64( $CipherText ); > > my $PlainText = $RSA_Decrypt->public_decrypt( $TmpText ); > #--> Error on the line above Double check that public key used to decrypt java message is really pair to private key on encryption side. You may use NO PADDING and look at decrypted data to check that this data looks reasonable or not. You should consider also that data encrypted with private key may by decrypted by anyone with public key (if public key is really public). Best regards, -- Marek Marcola <[EMAIL PROTECTED]> ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]