@@ -595,7 +595,7 @@ private static ASN1ObjectIdentifier osslNameToCipherOid(final String osslName) {
595595
596596 private String getPadding (final int padding ) {
597597 if ( padding < 1 || padding > 4 ) {
598- throw newRSAError (getRuntime (), "" );
598+ throw newPKeyError (getRuntime (), "" );
599599 }
600600 // BC accepts "/NONE/*" but SunJCE doesn't. use "/ECB/*"
601601 String p = "/ECB/PKCS1Padding" ;
@@ -615,7 +615,7 @@ public IRubyObject private_encrypt(final ThreadContext context, final IRubyObjec
615615 if ( Arity .checkArgumentCount (context .runtime , args , 1 , 2 ) == 2 && ! args [1 ].isNil () ) {
616616 padding = RubyNumeric .fix2int (args [1 ]);
617617 }
618- if ( privateKey == null ) throw newRSAError (context .runtime , "incomplete RSA" );
618+ if ( privateKey == null ) throw newPKeyError (context .runtime , "incomplete RSA" );
619619 return doCipherRSA (context .runtime , args [0 ], padding , ENCRYPT_MODE , privateKey );
620620 }
621621
@@ -625,7 +625,7 @@ public IRubyObject private_decrypt(final ThreadContext context, final IRubyObjec
625625 if ( Arity .checkArgumentCount (context .runtime , args , 1 , 2 ) == 2 && ! args [1 ].isNil ()) {
626626 padding = RubyNumeric .fix2int (args [1 ]);
627627 }
628- if ( privateKey == null ) throw newRSAError (context .runtime , "incomplete RSA" );
628+ if ( privateKey == null ) throw newPKeyError (context .runtime , "incomplete RSA" );
629629 return doCipherRSA (context .runtime , args [0 ], padding , DECRYPT_MODE , privateKey );
630630 }
631631
@@ -635,7 +635,7 @@ public IRubyObject public_encrypt(final ThreadContext context, final IRubyObject
635635 if ( Arity .checkArgumentCount (context .runtime , args , 1 , 2 ) == 2 && ! args [1 ].isNil ()) {
636636 padding = RubyNumeric .fix2int (args [1 ]);
637637 }
638- if ( publicKey == null ) throw newRSAError (context .runtime , "incomplete RSA" );
638+ if ( publicKey == null ) throw newPKeyError (context .runtime , "incomplete RSA" );
639639 return doCipherRSA (context .runtime , args [0 ], padding , ENCRYPT_MODE , publicKey );
640640 }
641641
@@ -645,7 +645,7 @@ public IRubyObject public_decrypt(final ThreadContext context, final IRubyObject
645645 if ( Arity .checkArgumentCount (context .runtime , args , 1 , 2 ) == 2 && ! args [1 ].isNil () ) {
646646 padding = RubyNumeric .fix2int (args [1 ]);
647647 }
648- if ( publicKey == null ) throw newRSAError (context .runtime , "incomplete RSA" );
648+ if ( publicKey == null ) throw newPKeyError (context .runtime , "incomplete RSA" );
649649 return doCipherRSA (context .runtime , args [0 ], padding , DECRYPT_MODE , publicKey );
650650 }
651651
0 commit comments