diff options
Diffstat (limited to 'prov/src/main/java/org/bouncycastle/jce/spec')
22 files changed, 0 insertions, 1387 deletions
diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/ECKeySpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/ECKeySpec.java deleted file mode 100644 index 12157844..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/ECKeySpec.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.security.spec.KeySpec; - -/** - * base class for an Elliptic Curve Key Spec - */ -public class ECKeySpec - implements KeySpec -{ - private ECParameterSpec spec; - - protected ECKeySpec( - ECParameterSpec spec) - { - this.spec = spec; - } - - /** - * return the domain parameters for the curve - */ - public ECParameterSpec getParams() - { - return spec; - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/ECNamedCurveGenParameterSpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/ECNamedCurveGenParameterSpec.java deleted file mode 100644 index a5dd319c..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/ECNamedCurveGenParameterSpec.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.security.spec.AlgorithmParameterSpec; - -/** - * Named curve generation spec - * <p> - * If you are using JDK 1.5 you should be looking at ECGenParameterSpec. - */ -public class ECNamedCurveGenParameterSpec - implements AlgorithmParameterSpec -{ - private String name; - - public ECNamedCurveGenParameterSpec( - String name) - { - this.name = name; - } - - /** - * return the name of the curve the EC domain parameters belong to. - */ - public String getName() - { - return name; - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/ECNamedCurveParameterSpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/ECNamedCurveParameterSpec.java deleted file mode 100644 index 4e749a58..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/ECNamedCurveParameterSpec.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.math.BigInteger; - -import org.bouncycastle.math.ec.ECCurve; -import org.bouncycastle.math.ec.ECPoint; - -/** - * specification signifying that the curve parameters can also be - * referred to by name. - * <p> - * If you are using JDK 1.5 you should be looking at {@link ECNamedCurveSpec}. - */ -public class ECNamedCurveParameterSpec - extends ECParameterSpec -{ - private String name; - - public ECNamedCurveParameterSpec( - String name, - ECCurve curve, - ECPoint G, - BigInteger n) - { - super(curve, G, n); - - this.name = name; - } - - public ECNamedCurveParameterSpec( - String name, - ECCurve curve, - ECPoint G, - BigInteger n, - BigInteger h) - { - super(curve, G, n, h); - - this.name = name; - } - - public ECNamedCurveParameterSpec( - String name, - ECCurve curve, - ECPoint G, - BigInteger n, - BigInteger h, - byte[] seed) - { - super(curve, G, n, h, seed); - - this.name = name; - } - - /** - * return the name of the curve the EC domain parameters belong to. - */ - public String getName() - { - return name; - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/ECNamedCurveSpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/ECNamedCurveSpec.java deleted file mode 100644 index c1b5ccc6..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/ECNamedCurveSpec.java +++ /dev/null @@ -1,123 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.math.BigInteger; -import java.security.spec.ECFieldF2m; -import java.security.spec.ECFieldFp; -import java.security.spec.ECPoint; -import java.security.spec.EllipticCurve; - -import org.bouncycastle.math.ec.ECAlgorithms; -import org.bouncycastle.math.ec.ECCurve; - -/** - * specification signifying that the curve parameters can also be - * referred to by name. - */ -public class ECNamedCurveSpec - extends java.security.spec.ECParameterSpec -{ - private String name; - - private static EllipticCurve convertCurve( - ECCurve curve, - byte[] seed) - { - if (ECAlgorithms.isFpCurve(curve)) - { - return new EllipticCurve(new ECFieldFp(curve.getField().getCharacteristic()), curve.getA().toBigInteger(), curve.getB().toBigInteger(), seed); - } - else - { - ECCurve.F2m curveF2m = (ECCurve.F2m)curve; - int ks[]; - - if (curveF2m.isTrinomial()) - { - ks = new int[] { curveF2m.getK1() }; - - return new EllipticCurve(new ECFieldF2m(curveF2m.getM(), ks), curve.getA().toBigInteger(), curve.getB().toBigInteger(), seed); - } - else - { - ks = new int[] { curveF2m.getK3(), curveF2m.getK2(), curveF2m.getK1() }; - - return new EllipticCurve(new ECFieldF2m(curveF2m.getM(), ks), curve.getA().toBigInteger(), curve.getB().toBigInteger(), seed); - } - } - - } - - private static ECPoint convertPoint( - org.bouncycastle.math.ec.ECPoint g) - { - g = g.normalize(); - return new ECPoint(g.getAffineXCoord().toBigInteger(), g.getAffineYCoord().toBigInteger()); - } - - public ECNamedCurveSpec( - String name, - ECCurve curve, - org.bouncycastle.math.ec.ECPoint g, - BigInteger n) - { - super(convertCurve(curve, null), convertPoint(g), n, 1); - - this.name = name; - } - - public ECNamedCurveSpec( - String name, - EllipticCurve curve, - ECPoint g, - BigInteger n) - { - super(curve, g, n, 1); - - this.name = name; - } - - public ECNamedCurveSpec( - String name, - ECCurve curve, - org.bouncycastle.math.ec.ECPoint g, - BigInteger n, - BigInteger h) - { - super(convertCurve(curve, null), convertPoint(g), n, h.intValue()); - - this.name = name; - } - - public ECNamedCurveSpec( - String name, - EllipticCurve curve, - ECPoint g, - BigInteger n, - BigInteger h) - { - super(curve, g, n, h.intValue()); - - this.name = name; - } - - public ECNamedCurveSpec( - String name, - ECCurve curve, - org.bouncycastle.math.ec.ECPoint g, - BigInteger n, - BigInteger h, - byte[] seed) - { - super(convertCurve(curve, seed), convertPoint(g), n, h.intValue()); - - this.name = name; - } - - /** - * return the name of the curve the EC domain parameters belong to. - */ - public String getName() - { - return name; - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/ECParameterSpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/ECParameterSpec.java deleted file mode 100644 index df91412c..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/ECParameterSpec.java +++ /dev/null @@ -1,121 +0,0 @@ -package org.bouncycastle.jce.spec; - -import org.bouncycastle.math.ec.ECCurve; -import org.bouncycastle.math.ec.ECPoint; - -import java.math.BigInteger; -import java.security.spec.AlgorithmParameterSpec; - -/** - * basic domain parameters for an Elliptic Curve public or private key. - */ -public class ECParameterSpec - implements AlgorithmParameterSpec -{ - private ECCurve curve; - private byte[] seed; - private ECPoint G; - private BigInteger n; - private BigInteger h; - - public ECParameterSpec( - ECCurve curve, - ECPoint G, - BigInteger n) - { - this.curve = curve; - this.G = G.normalize(); - this.n = n; - this.h = BigInteger.valueOf(1); - this.seed = null; - } - - public ECParameterSpec( - ECCurve curve, - ECPoint G, - BigInteger n, - BigInteger h) - { - this.curve = curve; - this.G = G.normalize(); - this.n = n; - this.h = h; - this.seed = null; - } - - public ECParameterSpec( - ECCurve curve, - ECPoint G, - BigInteger n, - BigInteger h, - byte[] seed) - { - this.curve = curve; - this.G = G.normalize(); - this.n = n; - this.h = h; - this.seed = seed; - } - - /** - * return the curve along which the base point lies. - * @return the curve - */ - public ECCurve getCurve() - { - return curve; - } - - /** - * return the base point we are using for these domain parameters. - * @return the base point. - */ - public ECPoint getG() - { - return G; - } - - /** - * return the order N of G - * @return the order - */ - public BigInteger getN() - { - return n; - } - - /** - * return the cofactor H to the order of G. - * @return the cofactor - */ - public BigInteger getH() - { - return h; - } - - /** - * return the seed used to generate this curve (if available). - * @return the random seed - */ - public byte[] getSeed() - { - return seed; - } - - public boolean equals(Object o) - { - if (!(o instanceof ECParameterSpec)) - { - return false; - } - - ECParameterSpec other = (ECParameterSpec)o; - - return this.getCurve().equals(other.getCurve()) && this.getG().equals(other.getG()); - } - - public int hashCode() - { - return this.getCurve().hashCode() ^ this.getG().hashCode(); - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/ECPrivateKeySpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/ECPrivateKeySpec.java deleted file mode 100644 index 27885c40..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/ECPrivateKeySpec.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.math.BigInteger; - -/** - * Elliptic Curve private key specification. - */ -public class ECPrivateKeySpec - extends ECKeySpec -{ - private BigInteger d; - - /** - * base constructor - * - * @param d the private number for the key. - * @param spec the domain parameters for the curve being used. - */ - public ECPrivateKeySpec( - BigInteger d, - ECParameterSpec spec) - { - super(spec); - - this.d = d; - } - - /** - * return the private number D - */ - public BigInteger getD() - { - return d; - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/ECPublicKeySpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/ECPublicKeySpec.java deleted file mode 100644 index 0e21a5bc..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/ECPublicKeySpec.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.bouncycastle.jce.spec; - -import org.bouncycastle.math.ec.ECPoint; - -/** - * Elliptic Curve public key specification - */ -public class ECPublicKeySpec - extends ECKeySpec -{ - private ECPoint q; - - /** - * base constructor - * - * @param q the public point on the curve. - * @param spec the domain parameters for the curve. - */ - public ECPublicKeySpec( - ECPoint q, - ECParameterSpec spec) - { - super(spec); - - if (q.getCurve() != null) - { - this.q = q.normalize(); - } - else - { - this.q = q; - } - } - - /** - * return the public point q - */ - public ECPoint getQ() - { - return q; - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/ElGamalGenParameterSpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/ElGamalGenParameterSpec.java deleted file mode 100644 index 200d2b4d..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/ElGamalGenParameterSpec.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.security.spec.AlgorithmParameterSpec; - -public class ElGamalGenParameterSpec - implements AlgorithmParameterSpec -{ - private int primeSize; - - /* - * @param primeSize the size (in bits) of the prime modulus. - */ - public ElGamalGenParameterSpec( - int primeSize) - { - this.primeSize = primeSize; - } - - /** - * Returns the size in bits of the prime modulus. - * - * @return the size in bits of the prime modulus - */ - public int getPrimeSize() - { - return primeSize; - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/ElGamalKeySpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/ElGamalKeySpec.java deleted file mode 100644 index 5e3eb663..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/ElGamalKeySpec.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.security.spec.KeySpec; - -public class ElGamalKeySpec - implements KeySpec -{ - private ElGamalParameterSpec spec; - - public ElGamalKeySpec( - ElGamalParameterSpec spec) - { - this.spec = spec; - } - - public ElGamalParameterSpec getParams() - { - return spec; - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/ElGamalParameterSpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/ElGamalParameterSpec.java deleted file mode 100644 index 10ed1c5d..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/ElGamalParameterSpec.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.math.BigInteger; -import java.security.spec.AlgorithmParameterSpec; - -public class ElGamalParameterSpec - implements AlgorithmParameterSpec -{ - private BigInteger p; - private BigInteger g; - - /** - * Constructs a parameter set for Diffie-Hellman, using a prime modulus - * <code>p</code> and a base generator <code>g</code>. - * - * @param p the prime modulus - * @param g the base generator - */ - public ElGamalParameterSpec( - BigInteger p, - BigInteger g) - { - this.p = p; - this.g = g; - } - - /** - * Returns the prime modulus <code>p</code>. - * - * @return the prime modulus <code>p</code> - */ - public BigInteger getP() - { - return p; - } - - /** - * Returns the base generator <code>g</code>. - * - * @return the base generator <code>g</code> - */ - public BigInteger getG() - { - return g; - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/ElGamalPrivateKeySpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/ElGamalPrivateKeySpec.java deleted file mode 100644 index 3a3c6e48..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/ElGamalPrivateKeySpec.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.math.BigInteger; - -/** - * This class specifies an ElGamal private key with its associated parameters. - * - * @see ElGamalPublicKeySpec - */ -public class ElGamalPrivateKeySpec - extends ElGamalKeySpec -{ - private BigInteger x; - - public ElGamalPrivateKeySpec( - BigInteger x, - ElGamalParameterSpec spec) - { - super(spec); - - this.x = x; - } - - /** - * Returns the private value <code>x</code>. - * - * @return the private value <code>x</code> - */ - public BigInteger getX() - { - return x; - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/ElGamalPublicKeySpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/ElGamalPublicKeySpec.java deleted file mode 100644 index c0e6dba1..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/ElGamalPublicKeySpec.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.math.BigInteger; - -/** - * This class specifies an ElGamal public key with its associated parameters. - * - * @see ElGamalPrivateKeySpec - */ -public class ElGamalPublicKeySpec - extends ElGamalKeySpec -{ - private BigInteger y; - - public ElGamalPublicKeySpec( - BigInteger y, - ElGamalParameterSpec spec) - { - super(spec); - - this.y = y; - } - - /** - * Returns the public value <code>y</code>. - * - * @return the public value <code>y</code> - */ - public BigInteger getY() - { - return y; - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/GOST28147ParameterSpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/GOST28147ParameterSpec.java deleted file mode 100644 index d03fbfe7..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/GOST28147ParameterSpec.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.bouncycastle.jce.spec; - -/** - * A parameter spec for the GOST-28147 cipher. - * @deprecated use org.bouncycastle.jcajce.spec.GOST28147ParameterSpec - */ -public class GOST28147ParameterSpec - extends org.bouncycastle.jcajce.spec.GOST28147ParameterSpec -{ - /** - * @deprecated - */ - public GOST28147ParameterSpec( - byte[] sBox) - { - super(sBox); - } - - /** - * @deprecated - */ - public GOST28147ParameterSpec( - byte[] sBox, - byte[] iv) - { - super(sBox, iv); - - } - - /** - * @deprecated - */ - public GOST28147ParameterSpec( - String sBoxName) - { - super(sBoxName); - } - - /** - * @deprecated - */ - public GOST28147ParameterSpec( - String sBoxName, - byte[] iv) - { - super(sBoxName, iv); - } -}
\ No newline at end of file diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/GOST3410ParameterSpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/GOST3410ParameterSpec.java deleted file mode 100644 index 6e0980db..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/GOST3410ParameterSpec.java +++ /dev/null @@ -1,133 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.security.spec.AlgorithmParameterSpec; - -import org.bouncycastle.asn1.ASN1ObjectIdentifier; -import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; -import org.bouncycastle.asn1.cryptopro.GOST3410NamedParameters; -import org.bouncycastle.asn1.cryptopro.GOST3410ParamSetParameters; -import org.bouncycastle.asn1.cryptopro.GOST3410PublicKeyAlgParameters; -import org.bouncycastle.jce.interfaces.GOST3410Params; - -/** - * ParameterSpec for a GOST 3410-94 key. - */ -public class GOST3410ParameterSpec - implements AlgorithmParameterSpec, GOST3410Params -{ - private GOST3410PublicKeyParameterSetSpec keyParameters; - private String keyParamSetOID; - private String digestParamSetOID; - private String encryptionParamSetOID; - - public GOST3410ParameterSpec( - String keyParamSetID, - String digestParamSetOID, - String encryptionParamSetOID) - { - GOST3410ParamSetParameters ecP = null; - - try - { - ecP = GOST3410NamedParameters.getByOID(new ASN1ObjectIdentifier(keyParamSetID)); - } - catch (IllegalArgumentException e) - { - ASN1ObjectIdentifier oid = GOST3410NamedParameters.getOID(keyParamSetID); - if (oid != null) - { - keyParamSetID = oid.getId(); - ecP = GOST3410NamedParameters.getByOID(oid); - } - } - - if (ecP == null) - { - throw new IllegalArgumentException("no key parameter set for passed in name/OID."); - } - - this.keyParameters = new GOST3410PublicKeyParameterSetSpec( - ecP.getP(), - ecP.getQ(), - ecP.getA()); - - this.keyParamSetOID = keyParamSetID; - this.digestParamSetOID = digestParamSetOID; - this.encryptionParamSetOID = encryptionParamSetOID; - } - - public GOST3410ParameterSpec( - String keyParamSetID, - String digestParamSetOID) - { - this(keyParamSetID, digestParamSetOID, null); - } - - public GOST3410ParameterSpec( - String keyParamSetID) - { - this(keyParamSetID, CryptoProObjectIdentifiers.gostR3411_94_CryptoProParamSet.getId(), null); - } - - public GOST3410ParameterSpec( - GOST3410PublicKeyParameterSetSpec spec) - { - this.keyParameters = spec; - this.digestParamSetOID = CryptoProObjectIdentifiers.gostR3411_94_CryptoProParamSet.getId(); - this.encryptionParamSetOID = null; - } - - public String getPublicKeyParamSetOID() - { - return this.keyParamSetOID; - } - - public GOST3410PublicKeyParameterSetSpec getPublicKeyParameters() - { - return keyParameters; - } - - public String getDigestParamSetOID() - { - return this.digestParamSetOID; - } - - public String getEncryptionParamSetOID() - { - return this.encryptionParamSetOID; - } - - public boolean equals(Object o) - { - if (o instanceof GOST3410ParameterSpec) - { - GOST3410ParameterSpec other = (GOST3410ParameterSpec)o; - - return this.keyParameters.equals(other.keyParameters) - && this.digestParamSetOID.equals(other.digestParamSetOID) - && (this.encryptionParamSetOID == other.encryptionParamSetOID - || (this.encryptionParamSetOID != null && this.encryptionParamSetOID.equals(other.encryptionParamSetOID))); - } - - return false; - } - - public int hashCode() - { - return this.keyParameters.hashCode() ^ this.digestParamSetOID.hashCode() - ^ (this.encryptionParamSetOID != null ? this.encryptionParamSetOID.hashCode() : 0); - } - - public static GOST3410ParameterSpec fromPublicKeyAlg( - GOST3410PublicKeyAlgParameters params) - { - if (params.getEncryptionParamSet() != null) - { - return new GOST3410ParameterSpec(params.getPublicKeyParamSet().getId(), params.getDigestParamSet().getId(), params.getEncryptionParamSet().getId()); - } - else - { - return new GOST3410ParameterSpec(params.getPublicKeyParamSet().getId(), params.getDigestParamSet().getId()); - } - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/GOST3410PrivateKeySpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/GOST3410PrivateKeySpec.java deleted file mode 100644 index 5ea13856..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/GOST3410PrivateKeySpec.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.math.BigInteger; -import java.security.spec.KeySpec; - -/** - * This class specifies a GOST3410-94 private key with its associated parameters. - */ - -public class GOST3410PrivateKeySpec - implements KeySpec -{ - private BigInteger x; - private BigInteger p; - private BigInteger q; - private BigInteger a; - - /** - * Creates a new GOST3410PrivateKeySpec with the specified parameter values. - * - * @param x the private key. - * @param p the prime. - * @param q the sub-prime. - * @param a the base. - */ - public GOST3410PrivateKeySpec(BigInteger x, BigInteger p, BigInteger q, - BigInteger a) - { - this.x = x; - this.p = p; - this.q = q; - this.a = a; - } - - /** - * Returns the private key <code>x</code>. - * @return the private key <code>x</code>. - */ - public BigInteger getX() - { - return this.x; - } - - /** - * Returns the prime <code>p</code>. - * @return the prime <code>p</code>. - */ - public BigInteger getP() - { - return this.p; - } - - /** - * Returns the sub-prime <code>q</code>. - * @return the sub-prime <code>q</code>. - */ - public BigInteger getQ() - { - return this.q; - } - - /** - * Returns the base <code>a</code>. - * @return the base <code>a</code>. - */ - public BigInteger getA() - { - return this.a; - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/GOST3410PublicKeyParameterSetSpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/GOST3410PublicKeyParameterSetSpec.java deleted file mode 100644 index 9e4e650a..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/GOST3410PublicKeyParameterSetSpec.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.math.BigInteger; - -/** - * ParameterSpec for a GOST 3410-94 key parameters. - */ -public class GOST3410PublicKeyParameterSetSpec -{ - private BigInteger p; - private BigInteger q; - private BigInteger a; - - /** - * Creates a new GOST3410ParameterSpec with the specified parameter values. - * - * @param p the prime. - * @param q the sub-prime. - * @param a the base. - */ - public GOST3410PublicKeyParameterSetSpec( - BigInteger p, - BigInteger q, - BigInteger a) - { - this.p = p; - this.q = q; - this.a = a; - } - - /** - * Returns the prime <code>p</code>. - * - * @return the prime <code>p</code>. - */ - public BigInteger getP() - { - return this.p; - } - - /** - * Returns the sub-prime <code>q</code>. - * - * @return the sub-prime <code>q</code>. - */ - public BigInteger getQ() - { - return this.q; - } - - /** - * Returns the base <code>a</code>. - * - * @return the base <code>a</code>. - */ - public BigInteger getA() - { - return this.a; - } - - public boolean equals( - Object o) - { - if (o instanceof GOST3410PublicKeyParameterSetSpec) - { - GOST3410PublicKeyParameterSetSpec other = (GOST3410PublicKeyParameterSetSpec)o; - - return this.a.equals(other.a) && this.p.equals(other.p) && this.q.equals(other.q); - } - - return false; - } - - public int hashCode() - { - return a.hashCode() ^ p.hashCode() ^ q.hashCode(); - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/GOST3410PublicKeySpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/GOST3410PublicKeySpec.java deleted file mode 100644 index 7b65c064..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/GOST3410PublicKeySpec.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.math.BigInteger; -import java.security.spec.KeySpec; - -/** - * This class specifies a GOST3410-94 public key with its associated parameters. - */ - -public class GOST3410PublicKeySpec - implements KeySpec -{ - - private BigInteger y; - private BigInteger p; - private BigInteger q; - private BigInteger a; - - /** - * Creates a new GOST3410PublicKeySpec with the specified parameter values. - * - * @param y the public key. - * @param p the prime. - * @param q the sub-prime. - * @param a the base. - */ - public GOST3410PublicKeySpec( - BigInteger y, - BigInteger p, - BigInteger q, - BigInteger a) - { - this.y = y; - this.p = p; - this.q = q; - this.a = a; - } - - /** - * Returns the public key <code>y</code>. - * - * @return the public key <code>y</code>. - */ - public BigInteger getY() - { - return this.y; - } - - /** - * Returns the prime <code>p</code>. - * - * @return the prime <code>p</code>. - */ - public BigInteger getP() - { - return this.p; - } - - /** - * Returns the sub-prime <code>q</code>. - * - * @return the sub-prime <code>q</code>. - */ - public BigInteger getQ() - { - return this.q; - } - - /** - * Returns the base <code>g</code>. - * - * @return the base <code>g</code>. - */ - public BigInteger getA() - { - return this.a; - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/IEKeySpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/IEKeySpec.java deleted file mode 100644 index 9859a22b..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/IEKeySpec.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.spec.KeySpec; - -import org.bouncycastle.jce.interfaces.IESKey; - -/** - * key pair for use with an integrated encryptor - together - * they provide what's required to generate the message. - */ -public class IEKeySpec - implements KeySpec, IESKey -{ - private PublicKey pubKey; - private PrivateKey privKey; - - /** - * @param privKey our private key. - * @param pubKey the public key of the sender/recipient. - */ - public IEKeySpec( - PrivateKey privKey, - PublicKey pubKey) - { - this.privKey = privKey; - this.pubKey = pubKey; - } - - /** - * return the intended recipient's/sender's public key. - */ - public PublicKey getPublic() - { - return pubKey; - } - - /** - * return the local private key. - */ - public PrivateKey getPrivate() - { - return privKey; - } - - /** - * return "IES" - */ - public String getAlgorithm() - { - return "IES"; - } - - /** - * return null - */ - public String getFormat() - { - return null; - } - - /** - * returns null - */ - public byte[] getEncoded() - { - return null; - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/IESParameterSpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/IESParameterSpec.java deleted file mode 100644 index 16a5fa2f..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/IESParameterSpec.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.security.spec.AlgorithmParameterSpec; - -import org.bouncycastle.util.Arrays; - -/** - * Parameter spec for an integrated encryptor, as in IEEE P1363a - */ -public class IESParameterSpec - implements AlgorithmParameterSpec -{ - private byte[] derivation; - private byte[] encoding; - private int macKeySize; - private int cipherKeySize; - private byte[] nonce; - - - /** - * Set the IES engine parameters. - * - * @param derivation the optional derivation vector for the KDF. - * @param encoding the optional encoding vector for the KDF. - * @param macKeySize the key size (in bits) for the MAC. - */ - public IESParameterSpec( - byte[] derivation, - byte[] encoding, - int macKeySize) - { - this(derivation, encoding, macKeySize, -1); - } - - - /** - * Set the IES engine parameters. - * - * @param derivation the optional derivation vector for the KDF. - * @param encoding the optional encoding vector for the KDF. - * @param macKeySize the key size (in bits) for the MAC. - * @param cipherKeySize the key size (in bits) for the block cipher. - */ - public IESParameterSpec( - byte[] derivation, - byte[] encoding, - int macKeySize, - int cipherKeySize) - { - this(derivation, encoding, macKeySize, cipherKeySize, null); - } - - /** - * Set the IES engine parameters. - * - * @param derivation the optional derivation vector for the KDF. - * @param encoding the optional encoding vector for the KDF. - * @param macKeySize the key size (in bits) for the MAC. - * @param cipherKeySize the key size (in bits) for the block cipher. - * @param nonce an IV to use initialising the block cipher. - */ - public IESParameterSpec( - byte[] derivation, - byte[] encoding, - int macKeySize, - int cipherKeySize, - byte[] nonce) - { - if (derivation != null) - { - this.derivation = new byte[derivation.length]; - System.arraycopy(derivation, 0, this.derivation, 0, derivation.length); - } - else - { - this.derivation = null; - } - - if (encoding != null) - { - this.encoding = new byte[encoding.length]; - System.arraycopy(encoding, 0, this.encoding, 0, encoding.length); - } - else - { - this.encoding = null; - } - - this.macKeySize = macKeySize; - this.cipherKeySize = cipherKeySize; - this.nonce = Arrays.clone(nonce); - } - - /** - * return the derivation vector. - */ - public byte[] getDerivationV() - { - return Arrays.clone(derivation); - } - - /** - * return the encoding vector. - */ - public byte[] getEncodingV() - { - return Arrays.clone(encoding); - } - - /** - * return the key size in bits for the MAC used with the message - */ - public int getMacKeySize() - { - return macKeySize; - } - - /** - * return the key size in bits for the block cipher used with the message - */ - public int getCipherKeySize() - { - return cipherKeySize; - } - - /** - * Return the nonce (IV) value to be associated with message. - * - * @return block cipher IV for message. - */ - public byte[] getNonce() - { - return Arrays.clone(nonce); - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/MQVPrivateKeySpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/MQVPrivateKeySpec.java deleted file mode 100644 index bdd988d0..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/MQVPrivateKeySpec.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.spec.KeySpec; - -import org.bouncycastle.jce.interfaces.MQVPrivateKey; - -/** - * Static/ephemeral private key (pair) for use with ECMQV key agreement - * (Optionally provides the ephemeral public key) - */ -public class MQVPrivateKeySpec - implements KeySpec, MQVPrivateKey -{ - private PrivateKey staticPrivateKey; - private PrivateKey ephemeralPrivateKey; - private PublicKey ephemeralPublicKey; - - /** - * @param staticPrivateKey the static private key. - * @param ephemeralPrivateKey the ephemeral private key. - */ - public MQVPrivateKeySpec( - PrivateKey staticPrivateKey, - PrivateKey ephemeralPrivateKey) - { - this(staticPrivateKey, ephemeralPrivateKey, null); - } - - /** - * @param staticPrivateKey the static private key. - * @param ephemeralPrivateKey the ephemeral private key. - * @param ephemeralPublicKey the ephemeral public key (may be null). - */ - public MQVPrivateKeySpec( - PrivateKey staticPrivateKey, - PrivateKey ephemeralPrivateKey, - PublicKey ephemeralPublicKey) - { - this.staticPrivateKey = staticPrivateKey; - this.ephemeralPrivateKey = ephemeralPrivateKey; - this.ephemeralPublicKey = ephemeralPublicKey; - } - - /** - * return the static private key - */ - public PrivateKey getStaticPrivateKey() - { - return staticPrivateKey; - } - - /** - * return the ephemeral private key - */ - public PrivateKey getEphemeralPrivateKey() - { - return ephemeralPrivateKey; - } - - /** - * return the ephemeral public key (may be null) - */ - public PublicKey getEphemeralPublicKey() - { - return ephemeralPublicKey; - } - - /** - * return "ECMQV" - */ - public String getAlgorithm() - { - return "ECMQV"; - } - - /** - * return null - */ - public String getFormat() - { - return null; - } - - /** - * returns null - */ - public byte[] getEncoded() - { - return null; - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/MQVPublicKeySpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/MQVPublicKeySpec.java deleted file mode 100644 index 8b50d05f..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/MQVPublicKeySpec.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.bouncycastle.jce.spec; - -import java.security.PublicKey; -import java.security.spec.KeySpec; - -import org.bouncycastle.jce.interfaces.MQVPublicKey; - -/** - * Static/ephemeral public key pair for use with ECMQV key agreement - */ -public class MQVPublicKeySpec - implements KeySpec, MQVPublicKey -{ - private PublicKey staticKey; - private PublicKey ephemeralKey; - - /** - * @param staticKey the static public key. - * @param ephemeralKey the ephemeral public key. - */ - public MQVPublicKeySpec( - PublicKey staticKey, - PublicKey ephemeralKey) - { - this.staticKey = staticKey; - this.ephemeralKey = ephemeralKey; - } - - /** - * return the static public key - */ - public PublicKey getStaticKey() - { - return staticKey; - } - - /** - * return the ephemeral public key - */ - public PublicKey getEphemeralKey() - { - return ephemeralKey; - } - - /** - * return "ECMQV" - */ - public String getAlgorithm() - { - return "ECMQV"; - } - - /** - * return null - */ - public String getFormat() - { - return null; - } - - /** - * returns null - */ - public byte[] getEncoded() - { - return null; - } -} diff --git a/prov/src/main/java/org/bouncycastle/jce/spec/RepeatedSecretKeySpec.java b/prov/src/main/java/org/bouncycastle/jce/spec/RepeatedSecretKeySpec.java deleted file mode 100644 index 41110728..00000000 --- a/prov/src/main/java/org/bouncycastle/jce/spec/RepeatedSecretKeySpec.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.bouncycastle.jce.spec; - -/** - * A simple object to indicate that a symmetric cipher should reuse the - * last key provided. - * @deprecated use super class org.bouncycastle.jcajce.spec.RepeatedSecretKeySpec - */ -public class RepeatedSecretKeySpec - extends org.bouncycastle.jcajce.spec.RepeatedSecretKeySpec -{ - private String algorithm; - - public RepeatedSecretKeySpec(String algorithm) - { - super(algorithm); - } -} |