FileDocCategorySizeDatePackage
RSAMultiPrimePrivateCrtKeySpec.javaAPI DocAndroid 1.5 API7533Wed May 06 22:41:06 BST 2009java.security.spec

RSAMultiPrimePrivateCrtKeySpec

public class RSAMultiPrimePrivateCrtKeySpec extends RSAPrivateKeySpec
The key specification of a RSA multi-prime private key with the Chinese Remainder Theorem (CRT) information values used.

Defined in the PKCS #1 v2.1 standard.

since
Android 1.0

Fields Summary
private final BigInteger
publicExponent
private final BigInteger
primeP
private final BigInteger
primeQ
private final BigInteger
primeExponentP
private final BigInteger
primeExponentQ
private final BigInteger
crtCoefficient
private final RSAOtherPrimeInfo[]
otherPrimeInfo
Constructors Summary
public RSAMultiPrimePrivateCrtKeySpec(BigInteger modulus, BigInteger publicExponent, BigInteger privateExponent, BigInteger primeP, BigInteger primeQ, BigInteger primeExponentP, BigInteger primeExponentQ, BigInteger crtCoefficient, RSAOtherPrimeInfo[] otherPrimeInfo)
Creates a new {@code RSAMultiPrimePrivateCrtKeySpec} with the specified modulus, public exponent, private exponent, prime factors, prime exponents, crt coefficient, and additional primes.

param
modulus the modulus {@code n}.
param
publicExponent the public exponent {@code e}.
param
privateExponent the private exponent {@code d}.
param
primeP the prime factor {@code p} of {@code n}.
param
primeQ the prime factor {@code q} of {@code n}.
param
primeExponentP the exponent of the prime {@code p}.
param
primeExponentQ the exponent of the prime {@code q}.
param
crtCoefficient the CRT coefficient {@code q^-1 mod p}.
param
otherPrimeInfo the information for the additional primes or {@code null} if there are only the two primes ({@code p, q}).
throws
IllegalArgumentException if {@code otherPrimeInfo} is not null but empty.
since
Android 1.0


        super(modulus, privateExponent);

        // Perform checks specified
        if (modulus == null) {
            throw new NullPointerException(Messages.getString("security.83", "modulus")); //$NON-NLS-1$ //$NON-NLS-2$
        }
        if (privateExponent == null) {
            throw new NullPointerException(Messages.getString("security.83", "privateExponent")); //$NON-NLS-1$ //$NON-NLS-2$
        }
        if (publicExponent == null) {
            throw new NullPointerException(Messages.getString("security.83", "publicExponent")); //$NON-NLS-1$ //$NON-NLS-2$
        }
        if (primeP == null) {
            throw new NullPointerException(Messages.getString("security.83", "primeP")); //$NON-NLS-1$ //$NON-NLS-2$
        }
        if (primeQ == null) {
            throw new NullPointerException(Messages.getString("security.83", "primeQ")); //$NON-NLS-1$ //$NON-NLS-2$
        }
        if (primeExponentP == null) {
            throw new NullPointerException(Messages.getString("security.83", "primeExponentP")); //$NON-NLS-1$ //$NON-NLS-2$
        }
        if (primeExponentQ == null) {
            throw new NullPointerException(Messages.getString("security.83", "primeExponentQ")); //$NON-NLS-1$ //$NON-NLS-2$
        }
        if (crtCoefficient == null) {
            throw new NullPointerException(Messages.getString("security.83", "crtCoefficient")); //$NON-NLS-1$ //$NON-NLS-2$
        }

        if (otherPrimeInfo != null) {
            if (otherPrimeInfo.length == 0) {
                throw new IllegalArgumentException(
                Messages.getString("security.85")); //$NON-NLS-1$
            }
            // Clone array to prevent subsequent modification
            this.otherPrimeInfo = new RSAOtherPrimeInfo[otherPrimeInfo.length];
            System.arraycopy(otherPrimeInfo, 0,
                    this.otherPrimeInfo, 0, this.otherPrimeInfo.length);
        } else {
            this.otherPrimeInfo = null;
        }
        this.publicExponent = publicExponent;
        this.primeP = primeP;
        this.primeQ = primeQ;
        this.primeExponentP = primeExponentP;
        this.primeExponentQ = primeExponentQ;
        this.crtCoefficient = crtCoefficient;
    
Methods Summary
public java.math.BigIntegergetCrtCoefficient()
Returns the CRT coefficient, {@code q^-1 mod p}.

return
the CRT coefficient, {@code q^-1 mod p}.
since
Android 1.0

        return crtCoefficient;
    
public java.security.spec.RSAOtherPrimeInfo[]getOtherPrimeInfo()
Returns the information for the additional primes.

return
the information for the additional primes, or {@code null} if there are only the two primes ({@code p, q}).
since
Android 1.0

        // Clone array (if not null) to prevent subsequent modification
        if (otherPrimeInfo == null) {
            return null;
        } else {
            RSAOtherPrimeInfo[] ret =
                new RSAOtherPrimeInfo[otherPrimeInfo.length];
            System.arraycopy(otherPrimeInfo, 0, ret, 0, ret.length);
            return ret;
        }
    
public java.math.BigIntegergetPrimeExponentP()
Returns the exponent of the prime {@code p}.

return
the exponent of the prime {@code p}.
since
Android 1.0

        return primeExponentP;
    
public java.math.BigIntegergetPrimeExponentQ()
Returns the exponent of the prime {@code q}.

return
the exponent of the prime {@code q}.
since
Android 1.0

        return primeExponentQ;
    
public java.math.BigIntegergetPrimeP()
Returns the prime factor {@code p}.

return
the prime factor {@code p}.
since
Android 1.0

        return primeP;
    
public java.math.BigIntegergetPrimeQ()
Returns the prime factor {@code q}.

return
the prime factor {@code q}.
since
Android 1.0

        return primeQ;
    
public java.math.BigIntegergetPublicExponent()
Returns the public exponent {@code e}.

return
the public exponent {@code e}.
since
Android 1.0

        return publicExponent;