Constructors Summary |
---|
JCERSAPrivateCrtKey(org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters key)construct a private key from it's org.bouncycastle.crypto equivalent.
super(key);
this.publicExponent = key.getPublicExponent();
this.primeP = key.getP();
this.primeQ = key.getQ();
this.primeExponentP = key.getDP();
this.primeExponentQ = key.getDQ();
this.crtCoefficient = key.getQInv();
|
JCERSAPrivateCrtKey(RSAPrivateCrtKeySpec spec)construct a private key from an RSAPrivateCrtKeySpec
this.modulus = spec.getModulus();
this.publicExponent = spec.getPublicExponent();
this.privateExponent = spec.getPrivateExponent();
this.primeP = spec.getPrimeP();
this.primeQ = spec.getPrimeQ();
this.primeExponentP = spec.getPrimeExponentP();
this.primeExponentQ = spec.getPrimeExponentQ();
this.crtCoefficient = spec.getCrtCoefficient();
|
JCERSAPrivateCrtKey(RSAPrivateCrtKey key)construct a private key from another RSAPrivateCrtKey.
this.modulus = key.getModulus();
this.publicExponent = key.getPublicExponent();
this.privateExponent = key.getPrivateExponent();
this.primeP = key.getPrimeP();
this.primeQ = key.getPrimeQ();
this.primeExponentP = key.getPrimeExponentP();
this.primeExponentQ = key.getPrimeExponentQ();
this.crtCoefficient = key.getCrtCoefficient();
|
JCERSAPrivateCrtKey(org.bouncycastle.asn1.pkcs.PrivateKeyInfo info)construct an RSA key from a private key info object.
this(new RSAPrivateKeyStructure((ASN1Sequence)info.getPrivateKey()));
|
JCERSAPrivateCrtKey(org.bouncycastle.asn1.pkcs.RSAPrivateKeyStructure key)construct an RSA key from a ASN.1 RSA private key object.
this.modulus = key.getModulus();
this.publicExponent = key.getPublicExponent();
this.privateExponent = key.getPrivateExponent();
this.primeP = key.getPrime1();
this.primeQ = key.getPrime2();
this.primeExponentP = key.getExponent1();
this.primeExponentQ = key.getExponent2();
this.crtCoefficient = key.getCoefficient();
|
Methods Summary |
---|
public boolean | equals(java.lang.Object o)
if (!(o instanceof RSAPrivateCrtKey))
{
return false;
}
if (o == this)
{
return true;
}
RSAPrivateCrtKey key = (RSAPrivateCrtKey)o;
return this.getModulus().equals(key.getModulus())
&& this.getPublicExponent().equals(key.getPublicExponent())
&& this.getPrivateExponent().equals(key.getPrivateExponent())
&& this.getPrimeP().equals(key.getPrimeP())
&& this.getPrimeQ().equals(key.getPrimeQ())
&& this.getPrimeExponentP().equals(key.getPrimeExponentP())
&& this.getPrimeExponentQ().equals(key.getPrimeExponentQ())
&& this.getCrtCoefficient().equals(key.getCrtCoefficient());
|
public java.math.BigInteger | getCrtCoefficient()return the CRT coefficient.
return crtCoefficient;
|
public byte[] | getEncoded()Return a PKCS8 representation of the key. The sequence returned
represents a full PrivateKeyInfo object.
// BEGIN android-changed
PrivateKeyInfo info = new PrivateKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, DERNull.THE_ONE), new RSAPrivateKeyStructure(getModulus(), getPublicExponent(), getPrivateExponent(), getPrimeP(), getPrimeQ(), getPrimeExponentP(), getPrimeExponentQ(), getCrtCoefficient()).getDERObject());
// END android-changed
return info.getDEREncoded();
|
public java.lang.String | getFormat()return the encoding format we produce in getEncoded().
return "PKCS#8";
|
public java.math.BigInteger | getPrimeExponentP()return the prime exponent for P.
return primeExponentP;
|
public java.math.BigInteger | getPrimeExponentQ()return the prime exponent for Q.
return primeExponentQ;
|
public java.math.BigInteger | getPrimeP()return the prime P.
return primeP;
|
public java.math.BigInteger | getPrimeQ()return the prime Q.
return primeQ;
|
public java.math.BigInteger | getPublicExponent()return the public exponent.
return publicExponent;
|
public java.lang.String | toString()
StringBuffer buf = new StringBuffer();
String nl = System.getProperty("line.separator");
buf.append("RSA Private CRT Key").append(nl);
buf.append(" modulus: ").append(this.getModulus().toString(16)).append(nl);
buf.append(" public exponent: ").append(this.getPublicExponent().toString(16)).append(nl);
buf.append(" private exponent: ").append(this.getPrivateExponent().toString(16)).append(nl);
buf.append(" primeP: ").append(this.getPrimeP().toString(16)).append(nl);
buf.append(" primeQ: ").append(this.getPrimeQ().toString(16)).append(nl);
buf.append(" primeExponentP: ").append(this.getPrimeExponentP().toString(16)).append(nl);
buf.append(" primeExponentQ: ").append(this.getPrimeExponentQ().toString(16)).append(nl);
buf.append(" crtCoefficient: ").append(this.getCrtCoefficient().toString(16)).append(nl);
return buf.toString();
|