File tree Expand file tree Collapse file tree 3 files changed +14
-7
lines changed
Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,13 @@ Crypt::OpenSSL::RSA - RSA encoding and decoding, using the openSSL libraries
8080 $signature = $rsa_priv->sign($plaintext);
8181 print "Signed correctly\n" if ($rsa->verify($plaintext, $signature));
8282
83+ =head1 SECURITY
84+
85+ Version 0.35 makes the use of PKCS#1 v1.5 padding a fatal error. It is
86+ very difficult to implement PKCS#1 v1.5 padding securely. If you are still
87+ using RSA in in general, you should be looking at alternative encryption
88+ algorithms.
89+
8390=head1 DESCRIPTION
8491
8592C<Crypt::OpenSSL::RSA > provides the ability to RSA encrypt strings which are
@@ -236,8 +243,11 @@ Encrypting user data directly with RSA is insecure.
236243
237244=item use_pkcs1_padding
238245
239- Use PKCS #1 v1.5 padding. This currently is the most widely used mode
240- of padding.
246+ PKCS #1 v1.5 padding has been disabled as it is nearly impossible to use this
247+ padding method in a secure manner. It is known to be vulnerable to timing
248+ based side channel attacks. use_pkcs1_padding() results in a fatal error.
249+
250+ L<Marvin Attack|https://github.com/tomato42/marvin-toolkit/blob/master/README.md>
241251
242252=item use_pkcs1_oaep_padding
243253
Original file line number Diff line number Diff line change 925925use_pkcs1_padding (p_rsa )
926926 rsaData * p_rsa ;
927927 CODE :
928- p_rsa -> padding = RSA_PKCS1_PADDING ;
928+ croak (" PKCS #1 1.5 is disabled as it is known to be vulnerable to marvin attacks.") ;
929929
930930void
931931use_pkcs1_oaep_padding (p_rsa )
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ use Crypt::OpenSSL::RSA;
66use Crypt::OpenSSL::Guess qw( openssl_version) ;
77
88BEGIN {
9- plan tests => 43 + ( UNIVERSAL::can( " Crypt::OpenSSL::RSA" , " use_sha512_hash" ) ? 4 * 5 : 0 ) + ( UNIVERSAL::can( " Crypt::OpenSSL::RSA" , " use_whirlpool_hash" ) ? 1 * 5 : 0 );
9+ plan tests => 37 + ( UNIVERSAL::can( " Crypt::OpenSSL::RSA" , " use_sha512_hash" ) ? 4 * 5 : 0 ) + ( UNIVERSAL::can( " Crypt::OpenSSL::RSA" , " use_whirlpool_hash" ) ? 1 * 5 : 0 );
1010}
1111
1212sub _Test_Encrypt_And_Decrypt {
@@ -76,9 +76,6 @@ ok( $rsa->check_key() );
7676$rsa -> use_no_padding();
7777_Test_Encrypt_And_Decrypt( $rsa -> size(), $rsa , 1 );
7878
79- $rsa -> use_pkcs1_padding();
80- _Test_Encrypt_And_Decrypt( $rsa -> size() - 11, $rsa , 1 );
81-
8279$rsa -> use_pkcs1_oaep_padding();
8380
8481# private_encrypt does not work with pkcs1_oaep_padding
You can’t perform that action at this time.
0 commit comments