summaryrefslogtreecommitdiff
path: root/bcprov/src
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2016-11-21 14:11:31 -0800
committerKenny Root <kroot@google.com>2017-02-09 11:53:24 -0800
commitb20c7cc53e71a96a04524bbcbcba29e30919e270 (patch)
treed6abafaef72c212883f47f7a36e356ba8247af2b /bcprov/src
parent18926e6f3fdd1f5da857d6e1be6e3102d1404e91 (diff)
downloadbouncycastle-b20c7cc53e71a96a04524bbcbcba29e30919e270.tar.gz
Remove unused Bouncycastle files
There's no way to reach these files since they are package permissions and nothing within the package references them. Test: cts-tradefed run cts -m CtsLibcoreTestCases Change-Id: I9d8ed1b2d58afb6ace617fe937dab42d6738b9ac
Diffstat (limited to 'bcprov/src')
-rw-r--r--bcprov/src/main/java/org/bouncycastle/jce/provider/JCERSAPrivateCrtKey.java242
-rw-r--r--bcprov/src/main/java/org/bouncycastle/jce/provider/JCERSAPrivateKey.java146
-rw-r--r--bcprov/src/main/java/org/bouncycastle/jce/provider/JCERSAPublicKey.java130
3 files changed, 0 insertions, 518 deletions
diff --git a/bcprov/src/main/java/org/bouncycastle/jce/provider/JCERSAPrivateCrtKey.java b/bcprov/src/main/java/org/bouncycastle/jce/provider/JCERSAPrivateCrtKey.java
deleted file mode 100644
index 40f007f3..00000000
--- a/bcprov/src/main/java/org/bouncycastle/jce/provider/JCERSAPrivateCrtKey.java
+++ /dev/null
@@ -1,242 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.interfaces.RSAPrivateCrtKey;
-import java.security.spec.RSAPrivateCrtKeySpec;
-
-import org.bouncycastle.asn1.DERNull;
-import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
-import org.bouncycastle.asn1.pkcs.RSAPrivateKey;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters;
-import org.bouncycastle.jcajce.provider.asymmetric.util.KeyUtil;
-import org.bouncycastle.util.Strings;
-
-/**
- * A provider representation for a RSA private key, with CRT factors included.
- */
-public class JCERSAPrivateCrtKey
- extends JCERSAPrivateKey
- implements RSAPrivateCrtKey
-{
- static final long serialVersionUID = 7834723820638524718L;
-
- private BigInteger publicExponent;
- private BigInteger primeP;
- private BigInteger primeQ;
- private BigInteger primeExponentP;
- private BigInteger primeExponentQ;
- private BigInteger crtCoefficient;
-
- /**
- * construct a private key from it's org.bouncycastle.crypto equivalent.
- *
- * @param key the parameters object representing the private key.
- */
- JCERSAPrivateCrtKey(
- RSAPrivateCrtKeyParameters key)
- {
- 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();
- }
-
- /**
- * construct a private key from an RSAPrivateCrtKeySpec
- *
- * @param spec the spec to be used in construction.
- */
- JCERSAPrivateCrtKey(
- RSAPrivateCrtKeySpec spec)
- {
- 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();
- }
-
- /**
- * construct a private key from another RSAPrivateCrtKey.
- *
- * @param key the object implementing the RSAPrivateCrtKey interface.
- */
- JCERSAPrivateCrtKey(
- RSAPrivateCrtKey key)
- {
- 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();
- }
-
- /**
- * construct an RSA key from a private key info object.
- */
- JCERSAPrivateCrtKey(
- PrivateKeyInfo info)
- throws IOException
- {
- this(org.bouncycastle.asn1.pkcs.RSAPrivateKey.getInstance(info.parsePrivateKey()));
- }
-
- /**
- * construct an RSA key from a ASN.1 RSA private key object.
- */
- JCERSAPrivateCrtKey(
- RSAPrivateKey key)
- {
- 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();
- }
-
- /**
- * return the encoding format we produce in getEncoded().
- *
- * @return the encoding format we produce in getEncoded().
- */
- public String getFormat()
- {
- return "PKCS#8";
- }
-
- /**
- * Return a PKCS8 representation of the key. The sequence returned
- * represents a full PrivateKeyInfo object.
- *
- * @return a PKCS8 representation of the key.
- */
- public byte[] getEncoded()
- {
- return KeyUtil.getEncodedPrivateKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, DERNull.INSTANCE), new RSAPrivateKey(getModulus(), getPublicExponent(), getPrivateExponent(), getPrimeP(), getPrimeQ(), getPrimeExponentP(), getPrimeExponentQ(), getCrtCoefficient()));
- }
-
- /**
- * return the public exponent.
- *
- * @return the public exponent.
- */
- public BigInteger getPublicExponent()
- {
- return publicExponent;
- }
-
- /**
- * return the prime P.
- *
- * @return the prime P.
- */
- public BigInteger getPrimeP()
- {
- return primeP;
- }
-
- /**
- * return the prime Q.
- *
- * @return the prime Q.
- */
- public BigInteger getPrimeQ()
- {
- return primeQ;
- }
-
- /**
- * return the prime exponent for P.
- *
- * @return the prime exponent for P.
- */
- public BigInteger getPrimeExponentP()
- {
- return primeExponentP;
- }
-
- /**
- * return the prime exponent for Q.
- *
- * @return the prime exponent for Q.
- */
- public BigInteger getPrimeExponentQ()
- {
- return primeExponentQ;
- }
-
- /**
- * return the CRT coefficient.
- *
- * @return the CRT coefficient.
- */
- public BigInteger getCrtCoefficient()
- {
- return crtCoefficient;
- }
-
- public int hashCode()
- {
- return this.getModulus().hashCode()
- ^ this.getPublicExponent().hashCode()
- ^ this.getPrivateExponent().hashCode();
- }
-
- public boolean equals(Object o)
- {
- if (o == this)
- {
- return true;
- }
-
- if (!(o instanceof RSAPrivateCrtKey))
- {
- return false;
- }
-
- 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 String toString()
- {
- StringBuffer buf = new StringBuffer();
- String nl = Strings.lineSeparator();
-
- 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();
- }
-}
diff --git a/bcprov/src/main/java/org/bouncycastle/jce/provider/JCERSAPrivateKey.java b/bcprov/src/main/java/org/bouncycastle/jce/provider/JCERSAPrivateKey.java
deleted file mode 100644
index cacedd4b..00000000
--- a/bcprov/src/main/java/org/bouncycastle/jce/provider/JCERSAPrivateKey.java
+++ /dev/null
@@ -1,146 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.math.BigInteger;
-import java.security.interfaces.RSAPrivateKey;
-import java.security.spec.RSAPrivateKeySpec;
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1ObjectIdentifier;
-import org.bouncycastle.asn1.DERNull;
-import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-import org.bouncycastle.crypto.params.RSAKeyParameters;
-import org.bouncycastle.jcajce.provider.asymmetric.util.KeyUtil;
-import org.bouncycastle.jcajce.provider.asymmetric.util.PKCS12BagAttributeCarrierImpl;
-import org.bouncycastle.jce.interfaces.PKCS12BagAttributeCarrier;
-
-public class JCERSAPrivateKey
- implements RSAPrivateKey, PKCS12BagAttributeCarrier
-{
- static final long serialVersionUID = 5110188922551353628L;
-
- private static BigInteger ZERO = BigInteger.valueOf(0);
-
- protected BigInteger modulus;
- protected BigInteger privateExponent;
-
- private PKCS12BagAttributeCarrierImpl attrCarrier = new PKCS12BagAttributeCarrierImpl();
-
- protected JCERSAPrivateKey()
- {
- }
-
- JCERSAPrivateKey(
- RSAKeyParameters key)
- {
- this.modulus = key.getModulus();
- this.privateExponent = key.getExponent();
- }
-
- JCERSAPrivateKey(
- RSAPrivateKeySpec spec)
- {
- this.modulus = spec.getModulus();
- this.privateExponent = spec.getPrivateExponent();
- }
-
- JCERSAPrivateKey(
- RSAPrivateKey key)
- {
- this.modulus = key.getModulus();
- this.privateExponent = key.getPrivateExponent();
- }
-
- public BigInteger getModulus()
- {
- return modulus;
- }
-
- public BigInteger getPrivateExponent()
- {
- return privateExponent;
- }
-
- public String getAlgorithm()
- {
- return "RSA";
- }
-
- public String getFormat()
- {
- return "PKCS#8";
- }
-
- public byte[] getEncoded()
- {
- return KeyUtil.getEncodedPrivateKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, DERNull.INSTANCE), new org.bouncycastle.asn1.pkcs.RSAPrivateKey(getModulus(), ZERO, getPrivateExponent(), ZERO, ZERO, ZERO, ZERO, ZERO));
- }
-
- public boolean equals(Object o)
- {
- if (!(o instanceof RSAPrivateKey))
- {
- return false;
- }
-
- if (o == this)
- {
- return true;
- }
-
- RSAPrivateKey key = (RSAPrivateKey)o;
-
- return getModulus().equals(key.getModulus())
- && getPrivateExponent().equals(key.getPrivateExponent());
- }
-
- public int hashCode()
- {
- return getModulus().hashCode() ^ getPrivateExponent().hashCode();
- }
-
- public void setBagAttribute(
- ASN1ObjectIdentifier oid,
- ASN1Encodable attribute)
- {
- attrCarrier.setBagAttribute(oid, attribute);
- }
-
- public ASN1Encodable getBagAttribute(
- ASN1ObjectIdentifier oid)
- {
- return attrCarrier.getBagAttribute(oid);
- }
-
- public Enumeration getBagAttributeKeys()
- {
- return attrCarrier.getBagAttributeKeys();
- }
-
- private void readObject(
- ObjectInputStream in)
- throws IOException, ClassNotFoundException
- {
- this.modulus = (BigInteger)in.readObject();
- this.attrCarrier = new PKCS12BagAttributeCarrierImpl();
-
- attrCarrier.readObject(in);
-
- this.privateExponent = (BigInteger)in.readObject();
- }
-
- private void writeObject(
- ObjectOutputStream out)
- throws IOException
- {
- out.writeObject(modulus);
-
- attrCarrier.writeObject(out);
-
- out.writeObject(privateExponent);
- }
-}
diff --git a/bcprov/src/main/java/org/bouncycastle/jce/provider/JCERSAPublicKey.java b/bcprov/src/main/java/org/bouncycastle/jce/provider/JCERSAPublicKey.java
deleted file mode 100644
index adf0e3e8..00000000
--- a/bcprov/src/main/java/org/bouncycastle/jce/provider/JCERSAPublicKey.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.interfaces.RSAPublicKey;
-import java.security.spec.RSAPublicKeySpec;
-
-import org.bouncycastle.asn1.DERNull;
-import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
-import org.bouncycastle.crypto.params.RSAKeyParameters;
-import org.bouncycastle.jcajce.provider.asymmetric.util.KeyUtil;
-import org.bouncycastle.util.Strings;
-
-public class JCERSAPublicKey
- implements RSAPublicKey
-{
- static final long serialVersionUID = 2675817738516720772L;
-
- private BigInteger modulus;
- private BigInteger publicExponent;
-
- JCERSAPublicKey(
- RSAKeyParameters key)
- {
- this.modulus = key.getModulus();
- this.publicExponent = key.getExponent();
- }
-
- JCERSAPublicKey(
- RSAPublicKeySpec spec)
- {
- this.modulus = spec.getModulus();
- this.publicExponent = spec.getPublicExponent();
- }
-
- JCERSAPublicKey(
- RSAPublicKey key)
- {
- this.modulus = key.getModulus();
- this.publicExponent = key.getPublicExponent();
- }
-
- JCERSAPublicKey(
- SubjectPublicKeyInfo info)
- {
- try
- {
- org.bouncycastle.asn1.pkcs.RSAPublicKey pubKey = org.bouncycastle.asn1.pkcs.RSAPublicKey.getInstance(info.parsePublicKey());
-
- this.modulus = pubKey.getModulus();
- this.publicExponent = pubKey.getPublicExponent();
- }
- catch (IOException e)
- {
- throw new IllegalArgumentException("invalid info structure in RSA public key");
- }
- }
-
- /**
- * return the modulus.
- *
- * @return the modulus.
- */
- public BigInteger getModulus()
- {
- return modulus;
- }
-
- /**
- * return the public exponent.
- *
- * @return the public exponent.
- */
- public BigInteger getPublicExponent()
- {
- return publicExponent;
- }
-
- public String getAlgorithm()
- {
- return "RSA";
- }
-
- public String getFormat()
- {
- return "X.509";
- }
-
- public byte[] getEncoded()
- {
- return KeyUtil.getEncodedSubjectPublicKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, DERNull.INSTANCE), new org.bouncycastle.asn1.pkcs.RSAPublicKey(getModulus(), getPublicExponent()));
- }
-
- public int hashCode()
- {
- return this.getModulus().hashCode() ^ this.getPublicExponent().hashCode();
- }
-
- public boolean equals(Object o)
- {
- if (o == this)
- {
- return true;
- }
-
- if (!(o instanceof RSAPublicKey))
- {
- return false;
- }
-
- RSAPublicKey key = (RSAPublicKey)o;
-
- return getModulus().equals(key.getModulus())
- && getPublicExponent().equals(key.getPublicExponent());
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer();
- String nl = Strings.lineSeparator();
-
- buf.append("RSA Public Key").append(nl);
- buf.append(" modulus: ").append(this.getModulus().toString(16)).append(nl);
- buf.append(" public exponent: ").append(this.getPublicExponent().toString(16)).append(nl);
-
- return buf.toString();
- }
-}