|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An interface with methods to return the factors and coefficient of an RSA modulus. These are useful for speeding up RSA operations using the Chinese Remainder Theorem.
It is not specified which factor is the larger, but the coefficient must be equal to the inverse of q modulo p.
Note that if the encryption exponent e, and the two factors are available to an attacker, the decryption exponent d can be found. This means that the factors must always be kept secret.
The intention is for implementations of RSAPrivateKey (and possibly
RSAPublicKey) to optionally implement this interface. Users of RSA keys can
check whether the key object is an instanceof RSAFactors
,
and if so make a further check that the factors are known for this key
(i.e. that getP
, getQ
and
getInverseOfQModP
return non-null values).
For example:
import java.security.interfaces.*;
void foo(RSAPrivateKey key) { BigInteger p = null, q = null, u = null;
if (key instanceof RSAFactors) { RSAFactors factors = (RSAFactors) key; p = factors.getP(); q = factors.getQ(); u = factors.getInverseOfQModP(); } if (p != null) { // efficient code (q and u can be assumed to be non-null) } else { // less efficient code } }
Key implementations should ensure that either all of the methods defined in this interface return null, or that none of them do.
This interface is not supported in JavaSoft's version of JCE.. To maintain compatibility, the RSAFactors classfile should be included with any application that uses it and may be linked against JavaSoft's JCE, so that the application will not fail with a NoClassDefFoundError.
Copyright © 1997
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
$Revision: 1.2 $
java.security.interfaces.RSAKey
Method Summary | |
java.math.BigInteger |
getInverseOfQModP()
Returns the coefficient, equal to the multiplicative inverse of q modulo p, or null if the factors of the modulus are unknown. |
java.math.BigInteger |
getP()
Returns the first prime factor, p, or null if the factors of the modulus are unknown. |
java.math.BigInteger |
getQ()
Returns the second prime factor, q, or null if the factors of the modulus are unknown. |
Method Detail |
public java.math.BigInteger getP()
public java.math.BigInteger getQ()
public java.math.BigInteger getInverseOfQModP()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |