|
From: <gel...@bo...> - 2003-08-13 08:30:09
|
gelderen 03/08/13 03:53:37
Modified: jce/src/cryptix.jce.provider.rsa RSAKeyFactory.java
Log:
- Re-order two instanceof tests so that subclass instanceness is
tested before superclass instanceness is.
Revision Changes Path
1.3 +9 -9 projects/jce/src/cryptix.jce.provider.rsa/RSAKeyFactory.java
Index: RSAKeyFactory.java
===================================================================
RCS file: /home/cryptix-cvs/cvsroot/projects/jce/src/cryptix.jce.provider.rsa/RSAKeyFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RSAKeyFactory.java 25 Aug 2000 01:21:10 -0000 1.2
+++ RSAKeyFactory.java 13 Aug 2003 07:53:37 -0000 1.3
@@ -1,4 +1,4 @@
-/* $Id: RSAKeyFactory.java,v 1.2 2000/08/25 01:21:10 gelderen Exp $
+/* $Id: RSAKeyFactory.java,v 1.3 2003/08/13 07:53:37 gelderen Exp $
*
* Copyright (C) 1995-1999 The Cryptix Foundation Limited.
* All rights reserved.
@@ -29,7 +29,7 @@
/**
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
* @author Jeroen C. van Gelderen (gel...@cr...)
*/
public final class RSAKeyFactory extends KeyFactorySpi {
@@ -47,13 +47,7 @@
protected PrivateKey engineGeneratePrivate(KeySpec keySpec)
throws InvalidKeySpecException
{
- if (keySpec instanceof RSAPrivateKeySpec) {
- RSAPrivateKeySpec s = (RSAPrivateKeySpec)keySpec;
- return new RSAPrivateKeyCryptix(
- s.getModulus(),
- s.getPrivateExponent() );
-
- } else if (keySpec instanceof RSAPrivateCrtKeySpec) {
+ if (keySpec instanceof RSAPrivateCrtKeySpec) {
RSAPrivateCrtKeySpec s = (RSAPrivateCrtKeySpec)keySpec;
return new RSAPrivateCrtKeyCryptix(
s.getModulus(),
@@ -64,6 +58,12 @@
s.getPrimeExponentP(),
s.getPrimeExponentQ(),
s.getCrtCoefficient() );
+
+ } else if (keySpec instanceof RSAPrivateKeySpec) {
+ RSAPrivateKeySpec s = (RSAPrivateKeySpec)keySpec;
+ return new RSAPrivateKeyCryptix(
+ s.getModulus(),
+ s.getPrivateExponent() );
} else if (keySpec instanceof X509EncodedKeySpec) {
return decodePrivateKey((X509EncodedKeySpec)keySpec);
|