Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/java/org/bouncycastle/crypto/params')
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/AEADParameters.java60
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/AsymmetricKeyParameter.java20
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/CCMParameters.java21
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/CramerShoupKeyGenerationParameters.java24
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/CramerShoupKeyParameters.java40
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/CramerShoupParameters.java53
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/CramerShoupPrivateKeyParameters.java61
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/CramerShoupPublicKeyParameters.java42
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/DESParameters.java107
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/DESedeParameters.java57
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/DHKeyGenerationParameters.java30
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/DHKeyParameters.java54
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/DHParameters.java189
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/DHPrivateKeyParameters.java41
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/DHPublicKeyParameters.java41
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/DHValidationParameters.java50
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/DSAKeyGenerationParameters.java25
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/DSAKeyParameters.java21
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/DSAParameterGenerationParameters.java80
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/DSAParameters.java74
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/DSAPrivateKeyParameters.java23
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/DSAPublicKeyParameters.java23
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/DSAValidationParameters.java65
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/ECDomainParameters.java74
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/ECKeyGenerationParameters.java25
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/ECKeyParameters.java21
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/ECNamedDomainParameters.java35
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/ECPrivateKeyParameters.java22
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/ECPublicKeyParameters.java22
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/ElGamalKeyGenerationParameters.java30
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/ElGamalKeyParameters.java47
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/ElGamalParameters.java69
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/ElGamalPrivateKeyParameters.java46
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/ElGamalPublicKeyParameters.java41
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/GOST3410KeyGenerationParameters.java25
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/GOST3410KeyParameters.java21
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/GOST3410Parameters.java74
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/GOST3410PrivateKeyParameters.java23
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/GOST3410PublicKeyParameters.java23
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/GOST3410ValidationParameters.java84
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/HKDFParameters.java123
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/IESParameters.java44
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/IESWithCipherParameters.java30
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/ISO18033KDFParameters.java23
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/KDFCounterParameters.java120
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/KDFDoublePipelineIterationParameters.java80
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/KDFFeedbackParameters.java96
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/KDFParameters.java31
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/KeyParameter.java30
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/MGFParameters.java32
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/MQVPrivateParameters.java43
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/MQVPublicParameters.java28
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/NaccacheSternKeyGenerationParameters.java97
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/NaccacheSternKeyParameters.java53
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/NaccacheSternPrivateKeyParameters.java50
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/ParametersWithIV.java39
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/ParametersWithRandom.java36
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/ParametersWithSBox.java28
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/ParametersWithSalt.java42
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/RC2Parameters.java36
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/RC5Parameters.java35
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/RSABlindingParameters.java35
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/RSAKeyGenerationParameters.java48
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/RSAKeyParameters.java31
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/RSAPrivateCrtKeyParameters.java67
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/SkeinParameters.java329
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/params/TweakableBlockCipherParameters.java40
67 files changed, 0 insertions, 3529 deletions
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/AEADParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/AEADParameters.java
deleted file mode 100644
index 9a9272ba..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/AEADParameters.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class AEADParameters
- implements CipherParameters
-{
- private byte[] associatedText;
- private byte[] nonce;
- private KeyParameter key;
- private int macSize;
-
- /**
- * Base constructor.
- *
- * @param key key to be used by underlying cipher
- * @param macSize macSize in bits
- * @param nonce nonce to be used
- */
- public AEADParameters(KeyParameter key, int macSize, byte[] nonce)
- {
- this(key, macSize, nonce, null);
- }
-
- /**
- * Base constructor.
- *
- * @param key key to be used by underlying cipher
- * @param macSize macSize in bits
- * @param nonce nonce to be used
- * @param associatedText initial associated text, if any
- */
- public AEADParameters(KeyParameter key, int macSize, byte[] nonce, byte[] associatedText)
- {
- this.key = key;
- this.nonce = nonce;
- this.macSize = macSize;
- this.associatedText = associatedText;
- }
-
- public KeyParameter getKey()
- {
- return key;
- }
-
- public int getMacSize()
- {
- return macSize;
- }
-
- public byte[] getAssociatedText()
- {
- return associatedText;
- }
-
- public byte[] getNonce()
- {
- return nonce;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/AsymmetricKeyParameter.java b/core/src/main/java/org/bouncycastle/crypto/params/AsymmetricKeyParameter.java
deleted file mode 100644
index 03ba7253..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/AsymmetricKeyParameter.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class AsymmetricKeyParameter
- implements CipherParameters
-{
- boolean privateKey;
-
- public AsymmetricKeyParameter(
- boolean privateKey)
- {
- this.privateKey = privateKey;
- }
-
- public boolean isPrivate()
- {
- return privateKey;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/CCMParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/CCMParameters.java
deleted file mode 100644
index 4924dcca..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/CCMParameters.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-/**
- * @deprecated use AEADParameters
- */
-public class CCMParameters
- extends AEADParameters
-{
- /**
- * Base constructor.
- *
- * @param key key to be used by underlying cipher
- * @param macSize macSize in bits
- * @param nonce nonce to be used
- * @param associatedText associated text, if any
- */
- public CCMParameters(KeyParameter key, int macSize, byte[] nonce, byte[] associatedText)
- {
- super(key, macSize, nonce, associatedText);
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/CramerShoupKeyGenerationParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/CramerShoupKeyGenerationParameters.java
deleted file mode 100644
index 15b6d6a5..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/CramerShoupKeyGenerationParameters.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.KeyGenerationParameters;
-
-public class CramerShoupKeyGenerationParameters extends KeyGenerationParameters {
-
- private CramerShoupParameters params;
-
- public CramerShoupKeyGenerationParameters(SecureRandom random, CramerShoupParameters params) {
- super(random, getStrength(params));
-
- this.params = params;
- }
-
- public CramerShoupParameters getParameters() {
- return params;
- }
-
- static int getStrength(CramerShoupParameters params) {
- return params.getP().bitLength();
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/CramerShoupKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/CramerShoupKeyParameters.java
deleted file mode 100644
index 9e4219c8..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/CramerShoupKeyParameters.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-public class CramerShoupKeyParameters extends AsymmetricKeyParameter {
-
- private CramerShoupParameters params;
-
- protected CramerShoupKeyParameters(boolean isPrivate, CramerShoupParameters params) {
- super(isPrivate);
-
- this.params = params;
- }
-
- public CramerShoupParameters getParameters() {
- return params;
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof CramerShoupKeyParameters)) {
- return false;
- }
-
- CramerShoupKeyParameters csKey = (CramerShoupKeyParameters) obj;
-
- if (params == null) {
- return csKey.getParameters() == null;
- } else {
- return params.equals(csKey.getParameters());
- }
- }
-
- public int hashCode() {
- int code = isPrivate() ? 0 : 1;
-
- if (params != null) {
- code ^= params.hashCode();
- }
-
- return code;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/CramerShoupParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/CramerShoupParameters.java
deleted file mode 100644
index 24264b6c..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/CramerShoupParameters.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.Digest;
-
-public class CramerShoupParameters implements CipherParameters {
-
- private BigInteger p; // prime order of G
- private BigInteger g1, g2; // generate G
-
- private Digest H; // hash function
-
- public CramerShoupParameters(BigInteger p, BigInteger g1, BigInteger g2, Digest H) {
- this.p = p;
- this.g1 = g1;
- this.g2 = g2;
- this.H = H;
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof DSAParameters)) {
- return false;
- }
-
- CramerShoupParameters pm = (CramerShoupParameters) obj;
-
- return (pm.getP().equals(p) && pm.getG1().equals(g1) && pm.getG2().equals(g2));
- }
-
- public int hashCode() {
- return getP().hashCode() ^ getG1().hashCode() ^ getG2().hashCode();
- }
-
- public BigInteger getG1() {
- return g1;
- }
-
- public BigInteger getG2() {
- return g2;
- }
-
- public BigInteger getP() {
- return p;
- }
-
- public Digest getH() {
- H.reset();
- return H;
- }
-
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/CramerShoupPrivateKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/CramerShoupPrivateKeyParameters.java
deleted file mode 100644
index 79de46ad..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/CramerShoupPrivateKeyParameters.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class CramerShoupPrivateKeyParameters extends CramerShoupKeyParameters {
-
- private BigInteger x1, x2, y1, y2, z; // Z_p
- private CramerShoupPublicKeyParameters pk; // public key
-
- public CramerShoupPrivateKeyParameters(CramerShoupParameters params, BigInteger x1, BigInteger x2, BigInteger y1, BigInteger y2, BigInteger z) {
- super(true, params);
-
- this.x1 = x1;
- this.x2 = x2;
- this.y1 = y1;
- this.y2 = y2;
- this.z = z;
- }
-
- public BigInteger getX1() {
- return x1;
- }
-
- public BigInteger getX2() {
- return x2;
- }
-
- public BigInteger getY1() {
- return y1;
- }
-
- public BigInteger getY2() {
- return y2;
- }
-
- public BigInteger getZ() {
- return z;
- }
-
- public void setPk(CramerShoupPublicKeyParameters pk) {
- this.pk = pk;
- }
-
- public CramerShoupPublicKeyParameters getPk() {
- return pk;
- }
-
- public int hashCode() {
- return x1.hashCode() ^ x2.hashCode() ^ y1.hashCode() ^ y2.hashCode() ^ z.hashCode() ^ super.hashCode();
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof CramerShoupPrivateKeyParameters)) {
- return false;
- }
-
- CramerShoupPrivateKeyParameters other = (CramerShoupPrivateKeyParameters) obj;
-
- return other.getX1().equals(this.x1) && other.getX2().equals(this.x2) && other.getY1().equals(this.y1) && other.getY2().equals(this.y2) && other.getZ().equals(this.z) && super.equals(obj);
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/CramerShoupPublicKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/CramerShoupPublicKeyParameters.java
deleted file mode 100644
index 341149c1..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/CramerShoupPublicKeyParameters.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class CramerShoupPublicKeyParameters extends CramerShoupKeyParameters {
-
- private BigInteger c, d, h; // public key group elements
-
- public CramerShoupPublicKeyParameters(CramerShoupParameters params, BigInteger c, BigInteger d, BigInteger h) {
- super(false, params);
-
- this.c = c;
- this.d = d;
- this.h = h;
- }
-
- public BigInteger getC() {
- return c;
- }
-
- public BigInteger getD() {
- return d;
- }
-
- public BigInteger getH() {
- return h;
- }
-
- public int hashCode() {
- return c.hashCode() ^ d.hashCode() ^ h.hashCode() ^ super.hashCode();
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof CramerShoupPublicKeyParameters)) {
- return false;
- }
-
- CramerShoupPublicKeyParameters other = (CramerShoupPublicKeyParameters) obj;
-
- return other.getC().equals(c) && other.getD().equals(d) && other.getH().equals(h) && super.equals(obj);
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/DESParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/DESParameters.java
deleted file mode 100644
index 5bee3604..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/DESParameters.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-public class DESParameters
- extends KeyParameter
-{
- public DESParameters(
- byte[] key)
- {
- super(key);
-
- if (isWeakKey(key, 0))
- {
- throw new IllegalArgumentException("attempt to create weak DES key");
- }
- }
-
- /*
- * DES Key length in bytes.
- */
- static public final int DES_KEY_LENGTH = 8;
-
- /*
- * Table of weak and semi-weak keys taken from Schneier pp281
- */
- static private final int N_DES_WEAK_KEYS = 16;
-
- static private byte[] DES_weak_keys =
- {
- /* weak keys */
- (byte)0x01,(byte)0x01,(byte)0x01,(byte)0x01, (byte)0x01,(byte)0x01,(byte)0x01,(byte)0x01,
- (byte)0x1f,(byte)0x1f,(byte)0x1f,(byte)0x1f, (byte)0x0e,(byte)0x0e,(byte)0x0e,(byte)0x0e,
- (byte)0xe0,(byte)0xe0,(byte)0xe0,(byte)0xe0, (byte)0xf1,(byte)0xf1,(byte)0xf1,(byte)0xf1,
- (byte)0xfe,(byte)0xfe,(byte)0xfe,(byte)0xfe, (byte)0xfe,(byte)0xfe,(byte)0xfe,(byte)0xfe,
-
- /* semi-weak keys */
- (byte)0x01,(byte)0xfe,(byte)0x01,(byte)0xfe, (byte)0x01,(byte)0xfe,(byte)0x01,(byte)0xfe,
- (byte)0x1f,(byte)0xe0,(byte)0x1f,(byte)0xe0, (byte)0x0e,(byte)0xf1,(byte)0x0e,(byte)0xf1,
- (byte)0x01,(byte)0xe0,(byte)0x01,(byte)0xe0, (byte)0x01,(byte)0xf1,(byte)0x01,(byte)0xf1,
- (byte)0x1f,(byte)0xfe,(byte)0x1f,(byte)0xfe, (byte)0x0e,(byte)0xfe,(byte)0x0e,(byte)0xfe,
- (byte)0x01,(byte)0x1f,(byte)0x01,(byte)0x1f, (byte)0x01,(byte)0x0e,(byte)0x01,(byte)0x0e,
- (byte)0xe0,(byte)0xfe,(byte)0xe0,(byte)0xfe, (byte)0xf1,(byte)0xfe,(byte)0xf1,(byte)0xfe,
- (byte)0xfe,(byte)0x01,(byte)0xfe,(byte)0x01, (byte)0xfe,(byte)0x01,(byte)0xfe,(byte)0x01,
- (byte)0xe0,(byte)0x1f,(byte)0xe0,(byte)0x1f, (byte)0xf1,(byte)0x0e,(byte)0xf1,(byte)0x0e,
- (byte)0xe0,(byte)0x01,(byte)0xe0,(byte)0x01, (byte)0xf1,(byte)0x01,(byte)0xf1,(byte)0x01,
- (byte)0xfe,(byte)0x1f,(byte)0xfe,(byte)0x1f, (byte)0xfe,(byte)0x0e,(byte)0xfe,(byte)0x0e,
- (byte)0x1f,(byte)0x01,(byte)0x1f,(byte)0x01, (byte)0x0e,(byte)0x01,(byte)0x0e,(byte)0x01,
- (byte)0xfe,(byte)0xe0,(byte)0xfe,(byte)0xe0, (byte)0xfe,(byte)0xf1,(byte)0xfe,(byte)0xf1
- };
-
- /**
- * DES has 16 weak keys. This method will check
- * if the given DES key material is weak or semi-weak.
- * Key material that is too short is regarded as weak.
- * <p>
- * See <a href="http://www.counterpane.com/applied.html">"Applied
- * Cryptography"</a> by Bruce Schneier for more information.
- *
- * @return true if the given DES key material is weak or semi-weak,
- * false otherwise.
- */
- public static boolean isWeakKey(
- byte[] key,
- int offset)
- {
- if (key.length - offset < DES_KEY_LENGTH)
- {
- throw new IllegalArgumentException("key material too short.");
- }
-
- nextkey: for (int i = 0; i < N_DES_WEAK_KEYS; i++)
- {
- for (int j = 0; j < DES_KEY_LENGTH; j++)
- {
- if (key[j + offset] != DES_weak_keys[i * DES_KEY_LENGTH + j])
- {
- continue nextkey;
- }
- }
-
- return true;
- }
- return false;
- }
-
- /**
- * DES Keys use the LSB as the odd parity bit. This can
- * be used to check for corrupt keys.
- *
- * @param bytes the byte array to set the parity on.
- */
- public static void setOddParity(
- byte[] bytes)
- {
- for (int i = 0; i < bytes.length; i++)
- {
- int b = bytes[i];
- bytes[i] = (byte)((b & 0xfe) |
- ((((b >> 1) ^
- (b >> 2) ^
- (b >> 3) ^
- (b >> 4) ^
- (b >> 5) ^
- (b >> 6) ^
- (b >> 7)) ^ 0x01) & 0x01));
- }
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/DESedeParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/DESedeParameters.java
deleted file mode 100644
index 3a4bbfca..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/DESedeParameters.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-public class DESedeParameters
- extends DESParameters
-{
- /*
- * DES-EDE Key length in bytes.
- */
- static public final int DES_EDE_KEY_LENGTH = 24;
-
- public DESedeParameters(
- byte[] key)
- {
- super(key);
-
- if (isWeakKey(key, 0, key.length))
- {
- throw new IllegalArgumentException("attempt to create weak DESede key");
- }
- }
-
- /**
- * return true if the passed in key is a DES-EDE weak key.
- *
- * @param key bytes making up the key
- * @param offset offset into the byte array the key starts at
- * @param length number of bytes making up the key
- */
- public static boolean isWeakKey(
- byte[] key,
- int offset,
- int length)
- {
- for (int i = offset; i < length; i += DES_KEY_LENGTH)
- {
- if (DESParameters.isWeakKey(key, i))
- {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * return true if the passed in key is a DES-EDE weak key.
- *
- * @param key bytes making up the key
- * @param offset offset into the byte array the key starts at
- */
- public static boolean isWeakKey(
- byte[] key,
- int offset)
- {
- return isWeakKey(key, offset, key.length - offset);
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/DHKeyGenerationParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/DHKeyGenerationParameters.java
deleted file mode 100644
index 34c730eb..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/DHKeyGenerationParameters.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.KeyGenerationParameters;
-
-public class DHKeyGenerationParameters
- extends KeyGenerationParameters
-{
- private DHParameters params;
-
- public DHKeyGenerationParameters(
- SecureRandom random,
- DHParameters params)
- {
- super(random, getStrength(params));
-
- this.params = params;
- }
-
- public DHParameters getParameters()
- {
- return params;
- }
-
- static int getStrength(DHParameters params)
- {
- return params.getL() != 0 ? params.getL() : params.getP().bitLength();
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/DHKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/DHKeyParameters.java
deleted file mode 100644
index e686f357..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/DHKeyParameters.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-
-public class DHKeyParameters
- extends AsymmetricKeyParameter
-{
- private DHParameters params;
-
- protected DHKeyParameters(
- boolean isPrivate,
- DHParameters params)
- {
- super(isPrivate);
-
- this.params = params;
- }
-
- public DHParameters getParameters()
- {
- return params;
- }
-
- public boolean equals(
- Object obj)
- {
- if (!(obj instanceof DHKeyParameters))
- {
- return false;
- }
-
- DHKeyParameters dhKey = (DHKeyParameters)obj;
-
- if (params == null)
- {
- return dhKey.getParameters() == null;
- }
- else
- {
- return params.equals(dhKey.getParameters());
- }
- }
-
- public int hashCode()
- {
- int code = isPrivate() ? 0 : 1;
-
- if (params != null)
- {
- code ^= params.hashCode();
- }
-
- return code;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/DHParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/DHParameters.java
deleted file mode 100644
index b679287c..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/DHParameters.java
+++ /dev/null
@@ -1,189 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class DHParameters
- implements CipherParameters
-{
- private static final int DEFAULT_MINIMUM_LENGTH = 160;
-
- // not final due to compiler bug in "simpler" JDKs
- private BigInteger g;
- private BigInteger p;
- private BigInteger q;
- private BigInteger j;
- private int m;
- private int l;
- private DHValidationParameters validation;
-
- private static int getDefaultMParam(
- int lParam)
- {
- if (lParam == 0)
- {
- return DEFAULT_MINIMUM_LENGTH;
- }
-
- return lParam < DEFAULT_MINIMUM_LENGTH ? lParam : DEFAULT_MINIMUM_LENGTH;
- }
-
- public DHParameters(
- BigInteger p,
- BigInteger g)
- {
- this(p, g, null, 0);
- }
-
- public DHParameters(
- BigInteger p,
- BigInteger g,
- BigInteger q)
- {
- this(p, g, q, 0);
- }
-
- public DHParameters(
- BigInteger p,
- BigInteger g,
- BigInteger q,
- int l)
- {
- this(p, g, q, getDefaultMParam(l), l, null, null);
- }
-
- public DHParameters(
- BigInteger p,
- BigInteger g,
- BigInteger q,
- int m,
- int l)
- {
- this(p, g, q, m, l, null, null);
- }
-
- public DHParameters(
- BigInteger p,
- BigInteger g,
- BigInteger q,
- BigInteger j,
- DHValidationParameters validation)
- {
- this(p, g, q, DEFAULT_MINIMUM_LENGTH, 0, j, validation);
- }
-
- public DHParameters(
- BigInteger p,
- BigInteger g,
- BigInteger q,
- int m,
- int l,
- BigInteger j,
- DHValidationParameters validation)
- {
- if (l != 0)
- {
- BigInteger bigL = BigInteger.valueOf(2L ^ (l - 1));
- if (bigL.compareTo(p) == 1)
- {
- throw new IllegalArgumentException("when l value specified, it must satisfy 2^(l-1) <= p");
- }
- if (l < m)
- {
- throw new IllegalArgumentException("when l value specified, it may not be less than m value");
- }
- }
-
- this.g = g;
- this.p = p;
- this.q = q;
- this.m = m;
- this.l = l;
- this.j = j;
- this.validation = validation;
- }
-
- public BigInteger getP()
- {
- return p;
- }
-
- public BigInteger getG()
- {
- return g;
- }
-
- public BigInteger getQ()
- {
- return q;
- }
-
- /**
- * Return the subgroup factor J.
- *
- * @return subgroup factor
- */
- public BigInteger getJ()
- {
- return j;
- }
-
- /**
- * Return the minimum length of the private value.
- *
- * @return the minimum length of the private value in bits.
- */
- public int getM()
- {
- return m;
- }
-
- /**
- * Return the private value length in bits - if set, zero otherwise
- *
- * @return the private value length in bits, zero otherwise.
- */
- public int getL()
- {
- return l;
- }
-
- public DHValidationParameters getValidationParameters()
- {
- return validation;
- }
-
- public boolean equals(
- Object obj)
- {
- if (!(obj instanceof DHParameters))
- {
- return false;
- }
-
- DHParameters pm = (DHParameters)obj;
-
- if (this.getQ() != null)
- {
- if (!this.getQ().equals(pm.getQ()))
- {
- return false;
- }
- }
- else
- {
- if (pm.getQ() != null)
- {
- return false;
- }
- }
-
- return pm.getP().equals(p) && pm.getG().equals(g);
- }
-
- public int hashCode()
- {
- return getP().hashCode() ^ getG().hashCode() ^ (getQ() != null ? getQ().hashCode() : 0);
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/DHPrivateKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/DHPrivateKeyParameters.java
deleted file mode 100644
index ee1b34f9..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/DHPrivateKeyParameters.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class DHPrivateKeyParameters
- extends DHKeyParameters
-{
- private BigInteger x;
-
- public DHPrivateKeyParameters(
- BigInteger x,
- DHParameters params)
- {
- super(true, params);
-
- this.x = x;
- }
-
- public BigInteger getX()
- {
- return x;
- }
-
- public int hashCode()
- {
- return x.hashCode() ^ super.hashCode();
- }
-
- public boolean equals(
- Object obj)
- {
- if (!(obj instanceof DHPrivateKeyParameters))
- {
- return false;
- }
-
- DHPrivateKeyParameters other = (DHPrivateKeyParameters)obj;
-
- return other.getX().equals(this.x) && super.equals(obj);
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/DHPublicKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/DHPublicKeyParameters.java
deleted file mode 100644
index ed531603..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/DHPublicKeyParameters.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class DHPublicKeyParameters
- extends DHKeyParameters
-{
- private BigInteger y;
-
- public DHPublicKeyParameters(
- BigInteger y,
- DHParameters params)
- {
- super(false, params);
-
- this.y = y;
- }
-
- public BigInteger getY()
- {
- return y;
- }
-
- public int hashCode()
- {
- return y.hashCode() ^ super.hashCode();
- }
-
- public boolean equals(
- Object obj)
- {
- if (!(obj instanceof DHPublicKeyParameters))
- {
- return false;
- }
-
- DHPublicKeyParameters other = (DHPublicKeyParameters)obj;
-
- return other.getY().equals(y) && super.equals(obj);
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/DHValidationParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/DHValidationParameters.java
deleted file mode 100644
index b22f7a03..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/DHValidationParameters.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.util.Arrays;
-
-public class DHValidationParameters
-{
- private byte[] seed;
- private int counter;
-
- public DHValidationParameters(
- byte[] seed,
- int counter)
- {
- this.seed = seed;
- this.counter = counter;
- }
-
- public int getCounter()
- {
- return counter;
- }
-
- public byte[] getSeed()
- {
- return seed;
- }
-
- public boolean equals(
- Object o)
- {
- if (!(o instanceof DHValidationParameters))
- {
- return false;
- }
-
- DHValidationParameters other = (DHValidationParameters)o;
-
- if (other.counter != this.counter)
- {
- return false;
- }
-
- return Arrays.areEqual(this.seed, other.seed);
- }
-
- public int hashCode()
- {
- return counter ^ Arrays.hashCode(seed);
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/DSAKeyGenerationParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/DSAKeyGenerationParameters.java
deleted file mode 100644
index 29fa91e6..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/DSAKeyGenerationParameters.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.KeyGenerationParameters;
-
-public class DSAKeyGenerationParameters
- extends KeyGenerationParameters
-{
- private DSAParameters params;
-
- public DSAKeyGenerationParameters(
- SecureRandom random,
- DSAParameters params)
- {
- super(random, params.getP().bitLength() - 1);
-
- this.params = params;
- }
-
- public DSAParameters getParameters()
- {
- return params;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/DSAKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/DSAKeyParameters.java
deleted file mode 100644
index 11bb9d97..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/DSAKeyParameters.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-public class DSAKeyParameters
- extends AsymmetricKeyParameter
-{
- private DSAParameters params;
-
- public DSAKeyParameters(
- boolean isPrivate,
- DSAParameters params)
- {
- super(isPrivate);
-
- this.params = params;
- }
-
- public DSAParameters getParameters()
- {
- return params;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/DSAParameterGenerationParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/DSAParameterGenerationParameters.java
deleted file mode 100644
index ba841b8e..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/DSAParameterGenerationParameters.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.security.SecureRandom;
-
-public class DSAParameterGenerationParameters
-{
- public static final int DIGITAL_SIGNATURE_USAGE = 1;
- public static final int KEY_ESTABLISHMENT_USAGE = 2;
-
- private final int l;
- private final int n;
- private final int usageIndex;
- private final int certainty;
- private final SecureRandom random;
-
- /**
- * Construct without a usage index, this will do a random construction of G.
- *
- * @param L desired length of prime P in bits (the effective key size).
- * @param N desired length of prime Q in bits.
- * @param certainty certainty level for prime number generation.
- * @param random the source of randomness to use.
- */
- public DSAParameterGenerationParameters(
- int L,
- int N,
- int certainty,
- SecureRandom random)
- {
- this(L, N, certainty, random, -1);
- }
-
- /**
- * Construct for a specific usage index - this has the effect of using verifiable canonical generation of G.
- *
- * @param L desired length of prime P in bits (the effective key size).
- * @param N desired length of prime Q in bits.
- * @param certainty certainty level for prime number generation.
- * @param random the source of randomness to use.
- * @param usageIndex a valid usage index.
- */
- public DSAParameterGenerationParameters(
- int L,
- int N,
- int certainty,
- SecureRandom random,
- int usageIndex)
- {
- this.l = L;
- this.n = N;
- this.certainty = certainty;
- this.usageIndex = usageIndex;
- this.random = random;
- }
-
- public int getL()
- {
- return l;
- }
-
- public int getN()
- {
- return n;
- }
-
- public int getCertainty()
- {
- return certainty;
- }
-
- public SecureRandom getRandom()
- {
- return random;
- }
-
- public int getUsageIndex()
- {
- return usageIndex;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/DSAParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/DSAParameters.java
deleted file mode 100644
index 7f76d117..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/DSAParameters.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class DSAParameters
- implements CipherParameters
-{
- private BigInteger g;
- private BigInteger q;
- private BigInteger p;
- private DSAValidationParameters validation;
-
- public DSAParameters(
- BigInteger p,
- BigInteger q,
- BigInteger g)
- {
- this.g = g;
- this.p = p;
- this.q = q;
- }
-
- public DSAParameters(
- BigInteger p,
- BigInteger q,
- BigInteger g,
- DSAValidationParameters params)
- {
- this.g = g;
- this.p = p;
- this.q = q;
- this.validation = params;
- }
-
- public BigInteger getP()
- {
- return p;
- }
-
- public BigInteger getQ()
- {
- return q;
- }
-
- public BigInteger getG()
- {
- return g;
- }
-
- public DSAValidationParameters getValidationParameters()
- {
- return validation;
- }
-
- public boolean equals(
- Object obj)
- {
- if (!(obj instanceof DSAParameters))
- {
- return false;
- }
-
- DSAParameters pm = (DSAParameters)obj;
-
- return (pm.getP().equals(p) && pm.getQ().equals(q) && pm.getG().equals(g));
- }
-
- public int hashCode()
- {
- return getP().hashCode() ^ getQ().hashCode() ^ getG().hashCode();
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/DSAPrivateKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/DSAPrivateKeyParameters.java
deleted file mode 100644
index 3bef3f40..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/DSAPrivateKeyParameters.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class DSAPrivateKeyParameters
- extends DSAKeyParameters
-{
- private BigInteger x;
-
- public DSAPrivateKeyParameters(
- BigInteger x,
- DSAParameters params)
- {
- super(true, params);
-
- this.x = x;
- }
-
- public BigInteger getX()
- {
- return x;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/DSAPublicKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/DSAPublicKeyParameters.java
deleted file mode 100644
index c0066568..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/DSAPublicKeyParameters.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class DSAPublicKeyParameters
- extends DSAKeyParameters
-{
- private BigInteger y;
-
- public DSAPublicKeyParameters(
- BigInteger y,
- DSAParameters params)
- {
- super(false, params);
-
- this.y = y;
- }
-
- public BigInteger getY()
- {
- return y;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/DSAValidationParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/DSAValidationParameters.java
deleted file mode 100644
index 07d93d07..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/DSAValidationParameters.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.util.Arrays;
-
-public class DSAValidationParameters
-{
- private int usageIndex;
- private byte[] seed;
- private int counter;
-
- public DSAValidationParameters(
- byte[] seed,
- int counter)
- {
- this(seed, counter, -1);
- }
-
- public DSAValidationParameters(
- byte[] seed,
- int counter,
- int usageIndex)
- {
- this.seed = seed;
- this.counter = counter;
- this.usageIndex = usageIndex;
- }
-
- public int getCounter()
- {
- return counter;
- }
-
- public byte[] getSeed()
- {
- return seed;
- }
-
- public int getUsageIndex()
- {
- return usageIndex;
- }
-
- public int hashCode()
- {
- return counter ^ Arrays.hashCode(seed);
- }
-
- public boolean equals(
- Object o)
- {
- if (!(o instanceof DSAValidationParameters))
- {
- return false;
- }
-
- DSAValidationParameters other = (DSAValidationParameters)o;
-
- if (other.counter != this.counter)
- {
- return false;
- }
-
- return Arrays.areEqual(this.seed, other.seed);
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/ECDomainParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/ECDomainParameters.java
deleted file mode 100644
index 9cc6e727..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/ECDomainParameters.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.math.ec.ECConstants;
-import org.bouncycastle.math.ec.ECCurve;
-import org.bouncycastle.math.ec.ECPoint;
-import org.bouncycastle.util.Arrays;
-
-public class ECDomainParameters
- implements ECConstants
-{
- private ECCurve curve;
- private byte[] seed;
- private ECPoint G;
- private BigInteger n;
- private BigInteger h;
-
- public ECDomainParameters(
- ECCurve curve,
- ECPoint G,
- BigInteger n)
- {
- this(curve, G, n, ONE, null);
- }
-
- public ECDomainParameters(
- ECCurve curve,
- ECPoint G,
- BigInteger n,
- BigInteger h)
- {
- this(curve, G, n, h, null);
- }
-
- public ECDomainParameters(
- 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;
- }
-
- public ECCurve getCurve()
- {
- return curve;
- }
-
- public ECPoint getG()
- {
- return G;
- }
-
- public BigInteger getN()
- {
- return n;
- }
-
- public BigInteger getH()
- {
- return h;
- }
-
- public byte[] getSeed()
- {
- return Arrays.clone(seed);
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/ECKeyGenerationParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/ECKeyGenerationParameters.java
deleted file mode 100644
index be3f20f5..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/ECKeyGenerationParameters.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.KeyGenerationParameters;
-
-public class ECKeyGenerationParameters
- extends KeyGenerationParameters
-{
- private ECDomainParameters domainParams;
-
- public ECKeyGenerationParameters(
- ECDomainParameters domainParams,
- SecureRandom random)
- {
- super(random, domainParams.getN().bitLength());
-
- this.domainParams = domainParams;
- }
-
- public ECDomainParameters getDomainParameters()
- {
- return domainParams;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/ECKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/ECKeyParameters.java
deleted file mode 100644
index 19825c5b..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/ECKeyParameters.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-public class ECKeyParameters
- extends AsymmetricKeyParameter
-{
- ECDomainParameters params;
-
- protected ECKeyParameters(
- boolean isPrivate,
- ECDomainParameters params)
- {
- super(isPrivate);
-
- this.params = params;
- }
-
- public ECDomainParameters getParameters()
- {
- return params;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/ECNamedDomainParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/ECNamedDomainParameters.java
deleted file mode 100644
index 5b694bec..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/ECNamedDomainParameters.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.asn1.ASN1ObjectIdentifier;
-import org.bouncycastle.math.ec.ECCurve;
-import org.bouncycastle.math.ec.ECPoint;
-
-public class ECNamedDomainParameters
- extends ECDomainParameters
-{
- private ASN1ObjectIdentifier name;
-
- public ECNamedDomainParameters(ASN1ObjectIdentifier name, ECCurve curve, ECPoint G, BigInteger n)
- {
- this(name, curve, G, n, null, null);
- }
-
- public ECNamedDomainParameters(ASN1ObjectIdentifier name, ECCurve curve, ECPoint G, BigInteger n, BigInteger h)
- {
- this(name, curve, G, n, h, null);
- }
-
- public ECNamedDomainParameters(ASN1ObjectIdentifier name, ECCurve curve, ECPoint G, BigInteger n, BigInteger h, byte[] seed)
- {
- super(curve, G, n, h, seed);
-
- this.name = name;
- }
-
- public ASN1ObjectIdentifier getName()
- {
- return name;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/ECPrivateKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/ECPrivateKeyParameters.java
deleted file mode 100644
index 3e49983e..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/ECPrivateKeyParameters.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class ECPrivateKeyParameters
- extends ECKeyParameters
-{
- BigInteger d;
-
- public ECPrivateKeyParameters(
- BigInteger d,
- ECDomainParameters params)
- {
- super(true, params);
- this.d = d;
- }
-
- public BigInteger getD()
- {
- return d;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/ECPublicKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/ECPublicKeyParameters.java
deleted file mode 100644
index b6b3fb6d..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/ECPublicKeyParameters.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.math.ec.ECPoint;
-
-public class ECPublicKeyParameters
- extends ECKeyParameters
-{
- ECPoint Q;
-
- public ECPublicKeyParameters(
- ECPoint Q,
- ECDomainParameters params)
- {
- super(false, params);
- this.Q = Q.normalize();
- }
-
- public ECPoint getQ()
- {
- return Q;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/ElGamalKeyGenerationParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/ElGamalKeyGenerationParameters.java
deleted file mode 100644
index f5fbabd5..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/ElGamalKeyGenerationParameters.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.KeyGenerationParameters;
-
-public class ElGamalKeyGenerationParameters
- extends KeyGenerationParameters
-{
- private ElGamalParameters params;
-
- public ElGamalKeyGenerationParameters(
- SecureRandom random,
- ElGamalParameters params)
- {
- super(random, getStrength(params));
-
- this.params = params;
- }
-
- public ElGamalParameters getParameters()
- {
- return params;
- }
-
- static int getStrength(ElGamalParameters params)
- {
- return params.getL() != 0 ? params.getL() : params.getP().bitLength();
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/ElGamalKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/ElGamalKeyParameters.java
deleted file mode 100644
index 72506931..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/ElGamalKeyParameters.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-
-public class ElGamalKeyParameters
- extends AsymmetricKeyParameter
-{
- private ElGamalParameters params;
-
- protected ElGamalKeyParameters(
- boolean isPrivate,
- ElGamalParameters params)
- {
- super(isPrivate);
-
- this.params = params;
- }
-
- public ElGamalParameters getParameters()
- {
- return params;
- }
-
- public int hashCode()
- {
- return (params != null) ? params.hashCode() : 0;
- }
-
- public boolean equals(
- Object obj)
- {
- if (!(obj instanceof ElGamalKeyParameters))
- {
- return false;
- }
-
- ElGamalKeyParameters dhKey = (ElGamalKeyParameters)obj;
-
- if (params == null)
- {
- return dhKey.getParameters() == null;
- }
- else
- {
- return params.equals(dhKey.getParameters());
- }
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/ElGamalParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/ElGamalParameters.java
deleted file mode 100644
index 166eff35..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/ElGamalParameters.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class ElGamalParameters
- implements CipherParameters
-{
- private BigInteger g;
- private BigInteger p;
- private int l;
-
- public ElGamalParameters(
- BigInteger p,
- BigInteger g)
- {
- this(p, g, 0);
- }
-
- public ElGamalParameters(
- BigInteger p,
- BigInteger g,
- int l)
- {
- this.g = g;
- this.p = p;
- this.l = l;
- }
-
- public BigInteger getP()
- {
- return p;
- }
-
- /**
- * return the generator - g
- */
- public BigInteger getG()
- {
- return g;
- }
-
- /**
- * return private value limit - l
- */
- public int getL()
- {
- return l;
- }
-
- public boolean equals(
- Object obj)
- {
- if (!(obj instanceof ElGamalParameters))
- {
- return false;
- }
-
- ElGamalParameters pm = (ElGamalParameters)obj;
-
- return pm.getP().equals(p) && pm.getG().equals(g) && pm.getL() == l;
- }
-
- public int hashCode()
- {
- return (getP().hashCode() ^ getG().hashCode()) + l;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/ElGamalPrivateKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/ElGamalPrivateKeyParameters.java
deleted file mode 100644
index b8fb529f..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/ElGamalPrivateKeyParameters.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class ElGamalPrivateKeyParameters
- extends ElGamalKeyParameters
-{
- private BigInteger x;
-
- public ElGamalPrivateKeyParameters(
- BigInteger x,
- ElGamalParameters params)
- {
- super(true, params);
-
- this.x = x;
- }
-
- public BigInteger getX()
- {
- return x;
- }
-
- public boolean equals(
- Object obj)
- {
- if (!(obj instanceof ElGamalPrivateKeyParameters))
- {
- return false;
- }
-
- ElGamalPrivateKeyParameters pKey = (ElGamalPrivateKeyParameters)obj;
-
- if (!pKey.getX().equals(x))
- {
- return false;
- }
-
- return super.equals(obj);
- }
-
- public int hashCode()
- {
- return getX().hashCode();
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/ElGamalPublicKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/ElGamalPublicKeyParameters.java
deleted file mode 100644
index d7da7a93..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/ElGamalPublicKeyParameters.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class ElGamalPublicKeyParameters
- extends ElGamalKeyParameters
-{
- private BigInteger y;
-
- public ElGamalPublicKeyParameters(
- BigInteger y,
- ElGamalParameters params)
- {
- super(false, params);
-
- this.y = y;
- }
-
- public BigInteger getY()
- {
- return y;
- }
-
- public int hashCode()
- {
- return y.hashCode() ^ super.hashCode();
- }
-
- public boolean equals(
- Object obj)
- {
- if (!(obj instanceof ElGamalPublicKeyParameters))
- {
- return false;
- }
-
- ElGamalPublicKeyParameters other = (ElGamalPublicKeyParameters)obj;
-
- return other.getY().equals(y) && super.equals(obj);
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/GOST3410KeyGenerationParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/GOST3410KeyGenerationParameters.java
deleted file mode 100644
index 74e05a96..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/GOST3410KeyGenerationParameters.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.KeyGenerationParameters;
-
-import java.security.SecureRandom;
-
-public class GOST3410KeyGenerationParameters
- extends KeyGenerationParameters
-{
- private GOST3410Parameters params;
-
- public GOST3410KeyGenerationParameters(
- SecureRandom random,
- GOST3410Parameters params)
- {
- super(random, params.getP().bitLength() - 1);
-
- this.params = params;
- }
-
- public GOST3410Parameters getParameters()
- {
- return params;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/GOST3410KeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/GOST3410KeyParameters.java
deleted file mode 100644
index 6716924a..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/GOST3410KeyParameters.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-public class GOST3410KeyParameters
- extends AsymmetricKeyParameter
-{
- private GOST3410Parameters params;
-
- public GOST3410KeyParameters(
- boolean isPrivate,
- GOST3410Parameters params)
- {
- super(isPrivate);
-
- this.params = params;
- }
-
- public GOST3410Parameters getParameters()
- {
- return params;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/GOST3410Parameters.java b/core/src/main/java/org/bouncycastle/crypto/params/GOST3410Parameters.java
deleted file mode 100644
index 07450f61..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/GOST3410Parameters.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-import java.math.BigInteger;
-
-public class GOST3410Parameters
- implements CipherParameters
-{
- private BigInteger p;
- private BigInteger q;
- private BigInteger a;
- private GOST3410ValidationParameters validation;
-
- public GOST3410Parameters(
- BigInteger p,
- BigInteger q,
- BigInteger a)
- {
- this.p = p;
- this.q = q;
- this.a = a;
- }
-
- public GOST3410Parameters(
- BigInteger p,
- BigInteger q,
- BigInteger a,
- GOST3410ValidationParameters params)
- {
- this.a = a;
- this.p = p;
- this.q = q;
- this.validation = params;
- }
-
- public BigInteger getP()
- {
- return p;
- }
-
- public BigInteger getQ()
- {
- return q;
- }
-
- public BigInteger getA()
- {
- return a;
- }
-
- public GOST3410ValidationParameters getValidationParameters()
- {
- return validation;
- }
-
- public int hashCode()
- {
- return p.hashCode() ^ q.hashCode() ^ a.hashCode();
- }
-
- public boolean equals(
- Object obj)
- {
- if (!(obj instanceof GOST3410Parameters))
- {
- return false;
- }
-
- GOST3410Parameters pm = (GOST3410Parameters)obj;
-
- return (pm.getP().equals(p) && pm.getQ().equals(q) && pm.getA().equals(a));
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/GOST3410PrivateKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/GOST3410PrivateKeyParameters.java
deleted file mode 100644
index 408e0657..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/GOST3410PrivateKeyParameters.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class GOST3410PrivateKeyParameters
- extends GOST3410KeyParameters
-{
- private BigInteger x;
-
- public GOST3410PrivateKeyParameters(
- BigInteger x,
- GOST3410Parameters params)
- {
- super(true, params);
-
- this.x = x;
- }
-
- public BigInteger getX()
- {
- return x;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/GOST3410PublicKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/GOST3410PublicKeyParameters.java
deleted file mode 100644
index 9dfd2d98..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/GOST3410PublicKeyParameters.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class GOST3410PublicKeyParameters
- extends GOST3410KeyParameters
-{
- private BigInteger y;
-
- public GOST3410PublicKeyParameters(
- BigInteger y,
- GOST3410Parameters params)
- {
- super(false, params);
-
- this.y = y;
- }
-
- public BigInteger getY()
- {
- return y;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/GOST3410ValidationParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/GOST3410ValidationParameters.java
deleted file mode 100644
index c2a4fb57..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/GOST3410ValidationParameters.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-public class GOST3410ValidationParameters
-{
- private int x0;
- private int c;
- private long x0L;
- private long cL;
-
-
- public GOST3410ValidationParameters(
- int x0,
- int c)
- {
- this.x0 = x0;
- this.c = c;
- }
-
- public GOST3410ValidationParameters(
- long x0L,
- long cL)
- {
- this.x0L = x0L;
- this.cL = cL;
- }
-
- public int getC()
- {
- return c;
- }
-
- public int getX0()
- {
- return x0;
- }
-
- public long getCL()
- {
- return cL;
- }
-
- public long getX0L()
- {
- return x0L;
- }
-
- public boolean equals(
- Object o)
- {
- if (!(o instanceof GOST3410ValidationParameters))
- {
- return false;
- }
-
- GOST3410ValidationParameters other = (GOST3410ValidationParameters)o;
-
- if (other.c != this.c)
- {
- return false;
- }
-
- if (other.x0 != this.x0)
- {
- return false;
- }
-
- if (other.cL != this.cL)
- {
- return false;
- }
-
- if (other.x0L != this.x0L)
- {
- return false;
- }
-
- return true;
- }
-
- public int hashCode()
- {
- return x0 ^ c ^ (int) x0L ^ (int)(x0L >> 32) ^ (int) cL ^ (int)(cL >> 32);
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/HKDFParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/HKDFParameters.java
deleted file mode 100644
index 2db3ce61..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/HKDFParameters.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.DerivationParameters;
-import org.bouncycastle.util.Arrays;
-
-/**
- * Parameter class for the HKDFBytesGenerator class.
- */
-public class HKDFParameters
- implements DerivationParameters
-{
- private final byte[] ikm;
- private final boolean skipExpand;
- private final byte[] salt;
- private final byte[] info;
-
- private HKDFParameters(final byte[] ikm, final boolean skip,
- final byte[] salt, final byte[] info)
- {
- if (ikm == null)
- {
- throw new IllegalArgumentException(
- "IKM (input keying material) should not be null");
- }
-
- this.ikm = Arrays.clone(ikm);
-
- this.skipExpand = skip;
-
- if (salt == null || salt.length == 0)
- {
- this.salt = null;
- }
- else
- {
- this.salt = Arrays.clone(salt);
- }
-
- if (info == null)
- {
- this.info = new byte[0];
- }
- else
- {
- this.info = Arrays.clone(info);
- }
- }
-
- /**
- * Generates parameters for HKDF, specifying both the optional salt and
- * optional info. Step 1: Extract won't be skipped.
- *
- * @param ikm the input keying material or seed
- * @param salt the salt to use, may be null for a salt for hashLen zeros
- * @param info the info to use, may be null for an info field of zero bytes
- */
- public HKDFParameters(final byte[] ikm, final byte[] salt, final byte[] info)
- {
- this(ikm, false, salt, info);
- }
-
- /**
- * Factory method that makes the HKDF skip the extract part of the key
- * derivation function.
- *
- * @param ikm the input keying material or seed, directly used for step 2:
- * Expand
- * @param info the info to use, may be null for an info field of zero bytes
- * @return HKDFParameters that makes the implementation skip step 1
- */
- public static HKDFParameters skipExtractParameters(final byte[] ikm,
- final byte[] info)
- {
-
- return new HKDFParameters(ikm, true, null, info);
- }
-
- public static HKDFParameters defaultParameters(final byte[] ikm)
- {
- return new HKDFParameters(ikm, false, null, null);
- }
-
- /**
- * Returns the input keying material or seed.
- *
- * @return the keying material
- */
- public byte[] getIKM()
- {
- return Arrays.clone(ikm);
- }
-
- /**
- * Returns if step 1: extract has to be skipped or not
- *
- * @return true for skipping, false for no skipping of step 1
- */
- public boolean skipExtract()
- {
- return skipExpand;
- }
-
- /**
- * Returns the salt, or null if the salt should be generated as a byte array
- * of HashLen zeros.
- *
- * @return the salt, or null
- */
- public byte[] getSalt()
- {
- return Arrays.clone(salt);
- }
-
- /**
- * Returns the info field, which may be empty (null is converted to empty).
- *
- * @return the info field, never null
- */
- public byte[] getInfo()
- {
- return Arrays.clone(info);
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/IESParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/IESParameters.java
deleted file mode 100644
index 0600b346..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/IESParameters.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-/**
- * parameters for using an integrated cipher in stream mode.
- */
-public class IESParameters
- implements CipherParameters
-{
- private byte[] derivation;
- private byte[] encoding;
- private int macKeySize;
-
- /**
- * @param derivation the derivation parameter for the KDF function.
- * @param encoding the encoding parameter for the KDF function.
- * @param macKeySize the size of the MAC key (in bits).
- */
- public IESParameters(
- byte[] derivation,
- byte[] encoding,
- int macKeySize)
- {
- this.derivation = derivation;
- this.encoding = encoding;
- this.macKeySize = macKeySize;
- }
-
- public byte[] getDerivationV()
- {
- return derivation;
- }
-
- public byte[] getEncodingV()
- {
- return encoding;
- }
-
- public int getMacKeySize()
- {
- return macKeySize;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/IESWithCipherParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/IESWithCipherParameters.java
deleted file mode 100644
index ef61b2cc..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/IESWithCipherParameters.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-
-public class IESWithCipherParameters
- extends IESParameters
-{
- private int cipherKeySize;
-
- /**
- * @param derivation the derivation parameter for the KDF function.
- * @param encoding the encoding parameter for the KDF function.
- * @param macKeySize the size of the MAC key (in bits).
- * @param cipherKeySize the size of the associated Cipher key (in bits).
- */
- public IESWithCipherParameters(
- byte[] derivation,
- byte[] encoding,
- int macKeySize,
- int cipherKeySize)
- {
- super(derivation, encoding, macKeySize);
-
- this.cipherKeySize = cipherKeySize;
- }
-
- public int getCipherKeySize()
- {
- return cipherKeySize;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/ISO18033KDFParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/ISO18033KDFParameters.java
deleted file mode 100644
index 8dffe2ee..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/ISO18033KDFParameters.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.DerivationParameters;
-
-/**
- * parameters for Key derivation functions for ISO-18033
- */
-public class ISO18033KDFParameters
- implements DerivationParameters
-{
- byte[] seed;
-
- public ISO18033KDFParameters(
- byte[] seed)
- {
- this.seed = seed;
- }
-
- public byte[] getSeed()
- {
- return seed;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/KDFCounterParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/KDFCounterParameters.java
deleted file mode 100644
index 29d8b369..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/KDFCounterParameters.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.DerivationParameters;
-import org.bouncycastle.util.Arrays;
-
-/**
- * This KDF has been defined by the publicly available NIST SP 800-108 specification.
- * NIST SP800-108 allows for alternative orderings of the input fields, meaning that the input can be formated in multiple ways.
- * There are 3 supported formats: - Below [i]_2 is a counter of r-bits length concatenated to the fixedInputData.
- * <ul>
- * <li>1: K(i) := PRF( KI, [i]_2 || Label || 0x00 || Context || [L]_2 ) with the counter at the very beginning of the fixedInputData (The default implementation has this format)</li>
- * <li>2: K(i) := PRF( KI, Label || 0x00 || Context || [L]_2 || [i]_2 ) with the counter at the very end of the fixedInputData</li>
- * <li>3a: K(i) := PRF( KI, Label || 0x00 || [i]_2 || Context || [L]_2 ) OR:</li>
- * <li>3b: K(i) := PRF( KI, Label || 0x00 || [i]_2 || [L]_2 || Context ) OR:</li>
- * <li>3c: K(i) := PRF( KI, Label || [i]_2 || 0x00 || Context || [L]_2 ) etc... with the counter somewhere in the 'middle' of the fixedInputData.</li>
- * </ul>
- * <p>
- * This function must be called with the following KDFCounterParameters():
- * - KI <br/>
- * - The part of the fixedInputData that comes BEFORE the counter OR null <br/>
- * - the part of the fixedInputData that comes AFTER the counter OR null <br/>
- * - the length of the counter in bits (not bytes) <br/>
- * </p>
- * Resulting function calls assuming an 8 bit counter.
- * <ul>
- * <li>1. KDFCounterParameters(ki, null, "Label || 0x00 || Context || [L]_2]", 8); </li>
- * <li>2. KDFCounterParameters(ki, "Label || 0x00 || Context || [L]_2]", null, 8); </li>
- * <li>3a. KDFCounterParameters(ki, "Label || 0x00", "Context || [L]_2]", 8); </li>
- * <li>3b. KDFCounterParameters(ki, "Label || 0x00", "[L]_2] || Context", 8);</li>
- * <li>3c. KDFCounterParameters(ki, "Label", "0x00 || Context || [L]_2]", 8); </li>
- * </ul>
- */
-public final class KDFCounterParameters
- implements DerivationParameters
-{
-
- private byte[] ki;
- private byte[] fixedInputDataCounterPrefix;
- private byte[] fixedInputDataCounterSuffix;
- private int r;
-
- /**
- * Base constructor - suffix fixed input data only.
- *
- * @param ki the KDF seed
- * @param fixedInputDataCounterSuffix fixed input data to follow counter.
- * @param r length of the counter in bits.
- */
- public KDFCounterParameters(byte[] ki, byte[] fixedInputDataCounterSuffix, int r)
- {
- this(ki, null, fixedInputDataCounterSuffix, r);
- }
-
- /**
- * Base constructor - prefix and suffix fixed input data.
- *
- * @param ki the KDF seed
- * @param fixedInputDataCounterPrefix fixed input data to precede counter
- * @param fixedInputDataCounterSuffix fixed input data to follow counter.
- * @param r length of the counter in bits.
- */
- public KDFCounterParameters(byte[] ki, byte[] fixedInputDataCounterPrefix, byte[] fixedInputDataCounterSuffix, int r)
- {
- if (ki == null)
- {
- throw new IllegalArgumentException("A KDF requires Ki (a seed) as input");
- }
- this.ki = Arrays.clone(ki);
-
- if (fixedInputDataCounterPrefix == null)
- {
- this.fixedInputDataCounterPrefix = new byte[0];
- }
- else
- {
- this.fixedInputDataCounterPrefix = Arrays.clone(fixedInputDataCounterPrefix);
- }
-
- if (fixedInputDataCounterSuffix == null)
- {
- this.fixedInputDataCounterSuffix = new byte[0];
- }
- else
- {
- this.fixedInputDataCounterSuffix = Arrays.clone(fixedInputDataCounterSuffix);
- }
-
- if (r != 8 && r != 16 && r != 24 && r != 32)
- {
- throw new IllegalArgumentException("Length of counter should be 8, 16, 24 or 32");
- }
- this.r = r;
- }
-
- public byte[] getKI()
- {
- return ki;
- }
-
- public byte[] getFixedInputData()
- {
- //Retained for backwards compatibility
- return Arrays.clone(fixedInputDataCounterSuffix);
- }
-
- public byte[] getFixedInputDataCounterPrefix()
- {
- return Arrays.clone(fixedInputDataCounterPrefix);
- }
-
- public byte[] getFixedInputDataCounterSuffix()
- {
- return Arrays.clone(fixedInputDataCounterSuffix);
- }
-
- public int getR()
- {
- return r;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/KDFDoublePipelineIterationParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/KDFDoublePipelineIterationParameters.java
deleted file mode 100644
index 383678aa..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/KDFDoublePipelineIterationParameters.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.DerivationParameters;
-import org.bouncycastle.util.Arrays;
-
-/**
- * Note that counter is only supported at the location presented in the
- * NIST SP 800-108 specification, not in the additional locations present
- * in the CAVP test vectors.
- */
-public final class KDFDoublePipelineIterationParameters
- implements DerivationParameters
-{
-
- // could be any valid value, using 32, don't know why
- private static final int UNUSED_R = 32;
-
- private final byte[] ki;
- private final boolean useCounter;
- private final int r;
- private final byte[] fixedInputData;
-
- private KDFDoublePipelineIterationParameters(byte[] ki, byte[] fixedInputData, int r, boolean useCounter)
- {
- if (ki == null)
- {
- throw new IllegalArgumentException("A KDF requires Ki (a seed) as input");
- }
- this.ki = Arrays.clone(ki);
-
- if (fixedInputData == null)
- {
- this.fixedInputData = new byte[0];
- }
- else
- {
- this.fixedInputData = Arrays.clone(fixedInputData);
- }
-
- if (r != 8 && r != 16 && r != 24 && r != 32)
- {
- throw new IllegalArgumentException("Length of counter should be 8, 16, 24 or 32");
- }
- this.r = r;
-
- this.useCounter = useCounter;
- }
-
- public static KDFDoublePipelineIterationParameters createWithCounter(
- byte[] ki, byte[] fixedInputData, int r)
- {
- return new KDFDoublePipelineIterationParameters(ki, fixedInputData, r, true);
- }
-
- public static KDFDoublePipelineIterationParameters createWithoutCounter(
- byte[] ki, byte[] fixedInputData)
- {
- return new KDFDoublePipelineIterationParameters(ki, fixedInputData, UNUSED_R, false);
- }
-
- public byte[] getKI()
- {
- return ki;
- }
-
- public boolean useCounter()
- {
- return useCounter;
- }
-
- public int getR()
- {
- return r;
- }
-
- public byte[] getFixedInputData()
- {
- return Arrays.clone(fixedInputData);
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/KDFFeedbackParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/KDFFeedbackParameters.java
deleted file mode 100644
index 8a6e7f57..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/KDFFeedbackParameters.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.DerivationParameters;
-import org.bouncycastle.util.Arrays;
-
-/**
- * Note that counter is only supported at the location presented in the
- * NIST SP 800-108 specification, not in the additional locations present
- * in the CAVP test vectors.
- */
-public final class KDFFeedbackParameters
- implements DerivationParameters
-{
-
- // could be any valid value, using 32, don't know why
- private static final int UNUSED_R = -1;
-
- private final byte[] ki;
- private final byte[] iv;
- private final boolean useCounter;
- private final int r;
- private final byte[] fixedInputData;
-
- private KDFFeedbackParameters(byte[] ki, byte[] iv, byte[] fixedInputData, int r, boolean useCounter)
- {
- if (ki == null)
- {
- throw new IllegalArgumentException("A KDF requires Ki (a seed) as input");
- }
- this.ki = Arrays.clone(ki);
-
- if (fixedInputData == null)
- {
- this.fixedInputData = new byte[0];
- }
- else
- {
- this.fixedInputData = Arrays.clone(fixedInputData);
- }
-
- this.r = r;
-
- if (iv == null)
- {
- this.iv = new byte[0];
- }
- else
- {
- this.iv = Arrays.clone(iv);
- }
-
- this.useCounter = useCounter;
- }
-
- public static KDFFeedbackParameters createWithCounter(
- byte[] ki, final byte[] iv, byte[] fixedInputData, int r)
- {
- if (r != 8 && r != 16 && r != 24 && r != 32)
- {
- throw new IllegalArgumentException("Length of counter should be 8, 16, 24 or 32");
- }
-
- return new KDFFeedbackParameters(ki, iv, fixedInputData, r, true);
- }
-
- public static KDFFeedbackParameters createWithoutCounter(
- byte[] ki, final byte[] iv, byte[] fixedInputData)
- {
- return new KDFFeedbackParameters(ki, iv, fixedInputData, UNUSED_R, false);
- }
-
- public byte[] getKI()
- {
- return ki;
- }
-
- public byte[] getIV()
- {
- return iv;
- }
-
- public boolean useCounter()
- {
- return useCounter;
- }
-
- public int getR()
- {
- return r;
- }
-
- public byte[] getFixedInputData()
- {
- return Arrays.clone(fixedInputData);
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/KDFParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/KDFParameters.java
deleted file mode 100644
index f3bac647..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/KDFParameters.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.DerivationParameters;
-
-/**
- * parameters for Key derivation functions for IEEE P1363a
- */
-public class KDFParameters
- implements DerivationParameters
-{
- byte[] iv;
- byte[] shared;
-
- public KDFParameters(
- byte[] shared,
- byte[] iv)
- {
- this.shared = shared;
- this.iv = iv;
- }
-
- public byte[] getSharedSecret()
- {
- return shared;
- }
-
- public byte[] getIV()
- {
- return iv;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/KeyParameter.java b/core/src/main/java/org/bouncycastle/crypto/params/KeyParameter.java
deleted file mode 100644
index 5c4fe0e0..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/KeyParameter.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class KeyParameter
- implements CipherParameters
-{
- private byte[] key;
-
- public KeyParameter(
- byte[] key)
- {
- this(key, 0, key.length);
- }
-
- public KeyParameter(
- byte[] key,
- int keyOff,
- int keyLen)
- {
- this.key = new byte[keyLen];
-
- System.arraycopy(key, keyOff, this.key, 0, keyLen);
- }
-
- public byte[] getKey()
- {
- return key;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/MGFParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/MGFParameters.java
deleted file mode 100644
index 847bd989..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/MGFParameters.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.DerivationParameters;
-
-/**
- * parameters for mask derivation functions.
- */
-public class MGFParameters
- implements DerivationParameters
-{
- byte[] seed;
-
- public MGFParameters(
- byte[] seed)
- {
- this(seed, 0, seed.length);
- }
-
- public MGFParameters(
- byte[] seed,
- int off,
- int len)
- {
- this.seed = new byte[len];
- System.arraycopy(seed, off, this.seed, 0, len);
- }
-
- public byte[] getSeed()
- {
- return seed;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/MQVPrivateParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/MQVPrivateParameters.java
deleted file mode 100644
index 832c07fd..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/MQVPrivateParameters.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class MQVPrivateParameters
- implements CipherParameters
-{
- private ECPrivateKeyParameters staticPrivateKey;
- private ECPrivateKeyParameters ephemeralPrivateKey;
- private ECPublicKeyParameters ephemeralPublicKey;
-
- public MQVPrivateParameters(
- ECPrivateKeyParameters staticPrivateKey,
- ECPrivateKeyParameters ephemeralPrivateKey)
- {
- this(staticPrivateKey, ephemeralPrivateKey, null);
- }
-
- public MQVPrivateParameters(
- ECPrivateKeyParameters staticPrivateKey,
- ECPrivateKeyParameters ephemeralPrivateKey,
- ECPublicKeyParameters ephemeralPublicKey)
- {
- this.staticPrivateKey = staticPrivateKey;
- this.ephemeralPrivateKey = ephemeralPrivateKey;
- this.ephemeralPublicKey = ephemeralPublicKey;
- }
-
- public ECPrivateKeyParameters getStaticPrivateKey()
- {
- return staticPrivateKey;
- }
-
- public ECPrivateKeyParameters getEphemeralPrivateKey()
- {
- return ephemeralPrivateKey;
- }
-
- public ECPublicKeyParameters getEphemeralPublicKey()
- {
- return ephemeralPublicKey;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/MQVPublicParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/MQVPublicParameters.java
deleted file mode 100644
index b3b24671..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/MQVPublicParameters.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class MQVPublicParameters
- implements CipherParameters
-{
- private ECPublicKeyParameters staticPublicKey;
- private ECPublicKeyParameters ephemeralPublicKey;
-
- public MQVPublicParameters(
- ECPublicKeyParameters staticPublicKey,
- ECPublicKeyParameters ephemeralPublicKey)
- {
- this.staticPublicKey = staticPublicKey;
- this.ephemeralPublicKey = ephemeralPublicKey;
- }
-
- public ECPublicKeyParameters getStaticPublicKey()
- {
- return staticPublicKey;
- }
-
- public ECPublicKeyParameters getEphemeralPublicKey()
- {
- return ephemeralPublicKey;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/NaccacheSternKeyGenerationParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/NaccacheSternKeyGenerationParameters.java
deleted file mode 100644
index 758fcd79..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/NaccacheSternKeyGenerationParameters.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.KeyGenerationParameters;
-
-/**
- * Parameters for NaccacheStern public private key generation. For details on
- * this cipher, please see
- *
- * http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf
- */
-public class NaccacheSternKeyGenerationParameters extends KeyGenerationParameters
-{
-
- // private BigInteger publicExponent;
- private int certainty;
-
- private int cntSmallPrimes;
-
- private boolean debug = false;
-
- /**
- * Parameters for generating a NaccacheStern KeyPair.
- *
- * @param random
- * The source of randomness
- * @param strength
- * The desired strength of the Key in Bits
- * @param certainty
- * the probability that the generated primes are not really prime
- * as integer: 2^(-certainty) is then the probability
- * @param cntSmallPrimes
- * How many small key factors are desired
- */
- public NaccacheSternKeyGenerationParameters(SecureRandom random, int strength, int certainty, int cntSmallPrimes)
- {
- this(random, strength, certainty, cntSmallPrimes, false);
- }
-
- /**
- * Parameters for a NaccacheStern KeyPair.
- *
- * @param random
- * The source of randomness
- * @param strength
- * The desired strength of the Key in Bits
- * @param certainty
- * the probability that the generated primes are not really prime
- * as integer: 2^(-certainty) is then the probability
- * @param cntSmallPrimes
- * How many small key factors are desired
- * @param debug
- * Turn debugging on or off (reveals secret information, use with
- * caution)
- */
- public NaccacheSternKeyGenerationParameters(SecureRandom random,
- int strength, int certainty, int cntSmallPrimes, boolean debug)
- {
- super(random, strength);
-
- this.certainty = certainty;
- if (cntSmallPrimes % 2 == 1)
- {
- throw new IllegalArgumentException("cntSmallPrimes must be a multiple of 2");
- }
- if (cntSmallPrimes < 30)
- {
- throw new IllegalArgumentException("cntSmallPrimes must be >= 30 for security reasons");
- }
- this.cntSmallPrimes = cntSmallPrimes;
-
- this.debug = debug;
- }
-
- /**
- * @return Returns the certainty.
- */
- public int getCertainty()
- {
- return certainty;
- }
-
- /**
- * @return Returns the cntSmallPrimes.
- */
- public int getCntSmallPrimes()
- {
- return cntSmallPrimes;
- }
-
- public boolean isDebug()
- {
- return debug;
- }
-
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/NaccacheSternKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/NaccacheSternKeyParameters.java
deleted file mode 100644
index 21b6a286..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/NaccacheSternKeyParameters.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-/**
- * Public key parameters for NaccacheStern cipher. For details on this cipher,
- * please see
- *
- * http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf
- */
-public class NaccacheSternKeyParameters extends AsymmetricKeyParameter
-{
-
- private BigInteger g, n;
-
- int lowerSigmaBound;
-
- /**
- * @param privateKey
- */
- public NaccacheSternKeyParameters(boolean privateKey, BigInteger g, BigInteger n, int lowerSigmaBound)
- {
- super(privateKey);
- this.g = g;
- this.n = n;
- this.lowerSigmaBound = lowerSigmaBound;
- }
-
- /**
- * @return Returns the g.
- */
- public BigInteger getG()
- {
- return g;
- }
-
- /**
- * @return Returns the lowerSigmaBound.
- */
- public int getLowerSigmaBound()
- {
- return lowerSigmaBound;
- }
-
- /**
- * @return Returns the n.
- */
- public BigInteger getModulus()
- {
- return n;
- }
-
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/NaccacheSternPrivateKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/NaccacheSternPrivateKeyParameters.java
deleted file mode 100644
index 6d0ec486..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/NaccacheSternPrivateKeyParameters.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-import java.util.Vector;
-
-/**
- * Private key parameters for NaccacheStern cipher. For details on this cipher,
- * please see
- *
- * http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf
- */
-public class NaccacheSternPrivateKeyParameters extends NaccacheSternKeyParameters
-{
- private BigInteger phi_n;
- private Vector smallPrimes;
-
- /**
- * Constructs a NaccacheSternPrivateKey
- *
- * @param g
- * the public enryption parameter g
- * @param n
- * the public modulus n = p*q
- * @param lowerSigmaBound
- * the public lower sigma bound up to which data can be encrypted
- * @param smallPrimes
- * the small primes, of which sigma is constructed in the right
- * order
- * @param phi_n
- * the private modulus phi(n) = (p-1)(q-1)
- */
- public NaccacheSternPrivateKeyParameters(BigInteger g, BigInteger n,
- int lowerSigmaBound, Vector smallPrimes,
- BigInteger phi_n)
- {
- super(true, g, n, lowerSigmaBound);
- this.smallPrimes = smallPrimes;
- this.phi_n = phi_n;
- }
-
- public BigInteger getPhi_n()
- {
- return phi_n;
- }
-
- public Vector getSmallPrimes()
- {
- return smallPrimes;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/ParametersWithIV.java b/core/src/main/java/org/bouncycastle/crypto/params/ParametersWithIV.java
deleted file mode 100644
index 4a1e6e9a..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/ParametersWithIV.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class ParametersWithIV
- implements CipherParameters
-{
- private byte[] iv;
- private CipherParameters parameters;
-
- public ParametersWithIV(
- CipherParameters parameters,
- byte[] iv)
- {
- this(parameters, iv, 0, iv.length);
- }
-
- public ParametersWithIV(
- CipherParameters parameters,
- byte[] iv,
- int ivOff,
- int ivLen)
- {
- this.iv = new byte[ivLen];
- this.parameters = parameters;
-
- System.arraycopy(iv, ivOff, this.iv, 0, ivLen);
- }
-
- public byte[] getIV()
- {
- return iv;
- }
-
- public CipherParameters getParameters()
- {
- return parameters;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/ParametersWithRandom.java b/core/src/main/java/org/bouncycastle/crypto/params/ParametersWithRandom.java
deleted file mode 100644
index a7b18e51..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/ParametersWithRandom.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-import java.security.SecureRandom;
-
-public class ParametersWithRandom
- implements CipherParameters
-{
- private SecureRandom random;
- private CipherParameters parameters;
-
- public ParametersWithRandom(
- CipherParameters parameters,
- SecureRandom random)
- {
- this.random = random;
- this.parameters = parameters;
- }
-
- public ParametersWithRandom(
- CipherParameters parameters)
- {
- this(parameters, new SecureRandom());
- }
-
- public SecureRandom getRandom()
- {
- return random;
- }
-
- public CipherParameters getParameters()
- {
- return parameters;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/ParametersWithSBox.java b/core/src/main/java/org/bouncycastle/crypto/params/ParametersWithSBox.java
deleted file mode 100644
index b226a9d9..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/ParametersWithSBox.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class ParametersWithSBox
- implements CipherParameters
-{
- private CipherParameters parameters;
- private byte[] sBox;
-
- public ParametersWithSBox(
- CipherParameters parameters,
- byte[] sBox)
- {
- this.parameters = parameters;
- this.sBox = sBox;
- }
-
- public byte[] getSBox()
- {
- return sBox;
- }
-
- public CipherParameters getParameters()
- {
- return parameters;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/ParametersWithSalt.java b/core/src/main/java/org/bouncycastle/crypto/params/ParametersWithSalt.java
deleted file mode 100644
index 73765dd5..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/ParametersWithSalt.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-/**
- * Cipher parameters with a fixed salt value associated with them.
- */
-public class ParametersWithSalt
- implements CipherParameters
-{
- private byte[] salt;
- private CipherParameters parameters;
-
- public ParametersWithSalt(
- CipherParameters parameters,
- byte[] salt)
- {
- this(parameters, salt, 0, salt.length);
- }
-
- public ParametersWithSalt(
- CipherParameters parameters,
- byte[] salt,
- int saltOff,
- int saltLen)
- {
- this.salt = new byte[saltLen];
- this.parameters = parameters;
-
- System.arraycopy(salt, saltOff, this.salt, 0, saltLen);
- }
-
- public byte[] getSalt()
- {
- return salt;
- }
-
- public CipherParameters getParameters()
- {
- return parameters;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/RC2Parameters.java b/core/src/main/java/org/bouncycastle/crypto/params/RC2Parameters.java
deleted file mode 100644
index dc33ec5b..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/RC2Parameters.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class RC2Parameters
- implements CipherParameters
-{
- private byte[] key;
- private int bits;
-
- public RC2Parameters(
- byte[] key)
- {
- this(key, (key.length > 128) ? 1024 : (key.length * 8));
- }
-
- public RC2Parameters(
- byte[] key,
- int bits)
- {
- this.key = new byte[key.length];
- this.bits = bits;
-
- System.arraycopy(key, 0, this.key, 0, key.length);
- }
-
- public byte[] getKey()
- {
- return key;
- }
-
- public int getEffectiveKeyBits()
- {
- return bits;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/RC5Parameters.java b/core/src/main/java/org/bouncycastle/crypto/params/RC5Parameters.java
deleted file mode 100644
index 6cbd57f1..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/RC5Parameters.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class RC5Parameters
- implements CipherParameters
-{
- private byte[] key;
- private int rounds;
-
- public RC5Parameters(
- byte[] key,
- int rounds)
- {
- if (key.length > 255)
- {
- throw new IllegalArgumentException("RC5 key length can be no greater than 255");
- }
-
- this.key = new byte[key.length];
- this.rounds = rounds;
-
- System.arraycopy(key, 0, this.key, 0, key.length);
- }
-
- public byte[] getKey()
- {
- return key;
- }
-
- public int getRounds()
- {
- return rounds;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/RSABlindingParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/RSABlindingParameters.java
deleted file mode 100644
index c7fa6ba6..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/RSABlindingParameters.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-import java.math.BigInteger;
-
-public class RSABlindingParameters
- implements CipherParameters
-{
- private RSAKeyParameters publicKey;
- private BigInteger blindingFactor;
-
- public RSABlindingParameters(
- RSAKeyParameters publicKey,
- BigInteger blindingFactor)
- {
- if (publicKey instanceof RSAPrivateCrtKeyParameters)
- {
- throw new IllegalArgumentException("RSA parameters should be for a public key");
- }
-
- this.publicKey = publicKey;
- this.blindingFactor = blindingFactor;
- }
-
- public RSAKeyParameters getPublicKey()
- {
- return publicKey;
- }
-
- public BigInteger getBlindingFactor()
- {
- return blindingFactor;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/RSAKeyGenerationParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/RSAKeyGenerationParameters.java
deleted file mode 100644
index 38b55fcd..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/RSAKeyGenerationParameters.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.KeyGenerationParameters;
-
-public class RSAKeyGenerationParameters
- extends KeyGenerationParameters
-{
- private BigInteger publicExponent;
- private int certainty;
-
- public RSAKeyGenerationParameters(
- BigInteger publicExponent,
- SecureRandom random,
- int strength,
- int certainty)
- {
- super(random, strength);
-
- if (strength < 12)
- {
- throw new IllegalArgumentException("key strength too small");
- }
-
- //
- // public exponent cannot be even
- //
- if (!publicExponent.testBit(0))
- {
- throw new IllegalArgumentException("public exponent cannot be even");
- }
-
- this.publicExponent = publicExponent;
- this.certainty = certainty;
- }
-
- public BigInteger getPublicExponent()
- {
- return publicExponent;
- }
-
- public int getCertainty()
- {
- return certainty;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/RSAKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/RSAKeyParameters.java
deleted file mode 100644
index 4a2d9354..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/RSAKeyParameters.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class RSAKeyParameters
- extends AsymmetricKeyParameter
-{
- private BigInteger modulus;
- private BigInteger exponent;
-
- public RSAKeyParameters(
- boolean isPrivate,
- BigInteger modulus,
- BigInteger exponent)
- {
- super(isPrivate);
-
- this.modulus = modulus;
- this.exponent = exponent;
- }
-
- public BigInteger getModulus()
- {
- return modulus;
- }
-
- public BigInteger getExponent()
- {
- return exponent;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/RSAPrivateCrtKeyParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/RSAPrivateCrtKeyParameters.java
deleted file mode 100644
index b61cb5c4..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/RSAPrivateCrtKeyParameters.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class RSAPrivateCrtKeyParameters
- extends RSAKeyParameters
-{
- private BigInteger e;
- private BigInteger p;
- private BigInteger q;
- private BigInteger dP;
- private BigInteger dQ;
- private BigInteger qInv;
-
- /**
- *
- */
- public RSAPrivateCrtKeyParameters(
- BigInteger modulus,
- BigInteger publicExponent,
- BigInteger privateExponent,
- BigInteger p,
- BigInteger q,
- BigInteger dP,
- BigInteger dQ,
- BigInteger qInv)
- {
- super(true, modulus, privateExponent);
-
- this.e = publicExponent;
- this.p = p;
- this.q = q;
- this.dP = dP;
- this.dQ = dQ;
- this.qInv = qInv;
- }
-
- public BigInteger getPublicExponent()
- {
- return e;
- }
-
- public BigInteger getP()
- {
- return p;
- }
-
- public BigInteger getQ()
- {
- return q;
- }
-
- public BigInteger getDP()
- {
- return dP;
- }
-
- public BigInteger getDQ()
- {
- return dQ;
- }
-
- public BigInteger getQInv()
- {
- return qInv;
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/SkeinParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/SkeinParameters.java
deleted file mode 100644
index 326e106c..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/SkeinParameters.java
+++ /dev/null
@@ -1,329 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Locale;
-
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.digests.SkeinDigest;
-import org.bouncycastle.crypto.digests.SkeinEngine;
-import org.bouncycastle.crypto.macs.SkeinMac;
-import org.bouncycastle.util.Integers;
-
-/**
- * Parameters for the Skein hash function - a series of byte[] strings identified by integer tags.
- * <p>
- * Parameterised Skein can be used for:
- * <ul>
- * <li>MAC generation, by providing a {@link SkeinParameters.Builder#setKey(byte[]) key}.</li>
- * <li>Randomised hashing, by providing a {@link SkeinParameters.Builder#setNonce(byte[]) nonce}.</li>
- * <li>A hash function for digital signatures, associating a
- * {@link SkeinParameters.Builder#setPublicKey(byte[]) public key} with the message digest.</li>
- * <li>A key derivation function, by providing a
- * {@link SkeinParameters.Builder#setKeyIdentifier(byte[]) key identifier}.</li>
- * <li>Personalised hashing, by providing a
- * {@link SkeinParameters.Builder#setPersonalisation(Date, String, String) recommended format} or
- * {@link SkeinParameters.Builder#setPersonalisation(byte[]) arbitrary} personalisation string.</li>
- * </ul>
- *
- * @see SkeinEngine
- * @see SkeinDigest
- * @see SkeinMac
- */
-public class SkeinParameters
- implements CipherParameters
-{
- /**
- * The parameter type for a secret key, supporting MAC or KDF functions: {@value
- * #PARAM_TYPE_KEY}.
- */
- public static final int PARAM_TYPE_KEY = 0;
-
- /**
- * The parameter type for the Skein configuration block: {@value #PARAM_TYPE_CONFIG}.
- */
- public static final int PARAM_TYPE_CONFIG = 4;
-
- /**
- * The parameter type for a personalisation string: {@value #PARAM_TYPE_PERSONALISATION}.
- */
- public static final int PARAM_TYPE_PERSONALISATION = 8;
-
- /**
- * The parameter type for a public key: {@value #PARAM_TYPE_PUBLIC_KEY}.
- */
- public static final int PARAM_TYPE_PUBLIC_KEY = 12;
-
- /**
- * The parameter type for a key identifier string: {@value #PARAM_TYPE_KEY_IDENTIFIER}.
- */
- public static final int PARAM_TYPE_KEY_IDENTIFIER = 16;
-
- /**
- * The parameter type for a nonce: {@value #PARAM_TYPE_NONCE}.
- */
- public static final int PARAM_TYPE_NONCE = 20;
-
- /**
- * The parameter type for the message: {@value #PARAM_TYPE_MESSAGE}.
- */
- public static final int PARAM_TYPE_MESSAGE = 48;
-
- /**
- * The parameter type for the output transformation: {@value #PARAM_TYPE_OUTPUT}.
- */
- public static final int PARAM_TYPE_OUTPUT = 63;
-
- private Hashtable parameters;
-
- public SkeinParameters()
- {
- this(new Hashtable());
- }
-
- private SkeinParameters(final Hashtable parameters)
- {
- this.parameters = parameters;
- }
-
- /**
- * Obtains a map of type (Integer) to value (byte[]) for the parameters tracked in this object.
- */
- public Hashtable getParameters()
- {
- return parameters;
- }
-
- /**
- * Obtains the value of the {@link #PARAM_TYPE_KEY key parameter}, or <code>null</code> if not
- * set.
- */
- public byte[] getKey()
- {
- return (byte[])parameters.get(Integers.valueOf(PARAM_TYPE_KEY));
- }
-
- /**
- * Obtains the value of the {@link #PARAM_TYPE_PERSONALISATION personalisation parameter}, or
- * <code>null</code> if not set.
- */
- public byte[] getPersonalisation()
- {
- return (byte[])parameters.get(Integers.valueOf(PARAM_TYPE_PERSONALISATION));
- }
-
- /**
- * Obtains the value of the {@link #PARAM_TYPE_PUBLIC_KEY public key parameter}, or
- * <code>null</code> if not set.
- */
- public byte[] getPublicKey()
- {
- return (byte[])parameters.get(Integers.valueOf(PARAM_TYPE_PUBLIC_KEY));
- }
-
- /**
- * Obtains the value of the {@link #PARAM_TYPE_KEY_IDENTIFIER key identifier parameter}, or
- * <code>null</code> if not set.
- */
- public byte[] getKeyIdentifier()
- {
- return (byte[])parameters.get(Integers.valueOf(PARAM_TYPE_KEY_IDENTIFIER));
- }
-
- /**
- * Obtains the value of the {@link #PARAM_TYPE_NONCE nonce parameter}, or <code>null</code> if
- * not set.
- */
- public byte[] getNonce()
- {
- return (byte[])parameters.get(Integers.valueOf(PARAM_TYPE_NONCE));
- }
-
- /**
- * A builder for {@link SkeinParameters}.
- */
- public static class Builder
- {
- private Hashtable parameters = new Hashtable();
-
- public Builder()
- {
- }
-
- public Builder(Hashtable paramsMap)
- {
- Enumeration keys = paramsMap.keys();
- while (keys.hasMoreElements())
- {
- Integer key = (Integer)keys.nextElement();
- parameters.put(key, paramsMap.get(key));
- }
- }
-
- public Builder(SkeinParameters params)
- {
- Enumeration keys = params.parameters.keys();
- while (keys.hasMoreElements())
- {
- Integer key = (Integer)keys.nextElement();
- parameters.put(key, params.parameters.get(key));
- }
- }
-
- /**
- * Sets a parameters to apply to the Skein hash function.<br>
- * Parameter types must be in the range 0,5..62, and cannot use the value {@value
- * SkeinParameters#PARAM_TYPE_MESSAGE} (reserved for message body).
- * <p>
- * Parameters with type &lt; {@value SkeinParameters#PARAM_TYPE_MESSAGE} are processed before
- * the message content, parameters with type &gt; {@value SkeinParameters#PARAM_TYPE_MESSAGE}
- * are processed after the message and prior to output.
- *
- * @param type the type of the parameter, in the range 5..62.
- * @param value the byte sequence of the parameter.
- * @return
- */
- public Builder set(int type, byte[] value)
- {
- if (value == null)
- {
- throw new IllegalArgumentException("Parameter value must not be null.");
- }
- if ((type != PARAM_TYPE_KEY)
- && (type <= PARAM_TYPE_CONFIG || type >= PARAM_TYPE_OUTPUT || type == PARAM_TYPE_MESSAGE))
- {
- throw new IllegalArgumentException("Parameter types must be in the range 0,5..47,49..62.");
- }
- if (type == PARAM_TYPE_CONFIG)
- {
- throw new IllegalArgumentException("Parameter type " + PARAM_TYPE_CONFIG
- + " is reserved for internal use.");
- }
- this.parameters.put(Integers.valueOf(type), value);
- return this;
- }
-
- /**
- * Sets the {@link SkeinParameters#PARAM_TYPE_KEY} parameter.
- */
- public Builder setKey(byte[] key)
- {
- return set(PARAM_TYPE_KEY, key);
- }
-
- /**
- * Sets the {@link SkeinParameters#PARAM_TYPE_PERSONALISATION} parameter.
- */
- public Builder setPersonalisation(byte[] personalisation)
- {
- return set(PARAM_TYPE_PERSONALISATION, personalisation);
- }
-
- /**
- * Implements the recommended personalisation format for Skein defined in Section 4.11 of
- * the Skein 1.3 specification.
- * <p>
- * The format is <code>YYYYMMDD email@address distinguisher</code>, encoded to a byte
- * sequence using UTF-8 encoding.
- *
- * @param date the date the personalised application of the Skein was defined.
- * @param emailAddress the email address of the creation of the personalised application.
- * @param distinguisher an arbitrary personalisation string distinguishing the application.
- * @return the current builder.
- */
- public Builder setPersonalisation(Date date, String emailAddress, String distinguisher)
- {
- try
- {
- final ByteArrayOutputStream bout = new ByteArrayOutputStream();
- final OutputStreamWriter out = new OutputStreamWriter(bout, "UTF-8");
- final DateFormat format = new SimpleDateFormat("YYYYMMDD");
- out.write(format.format(date));
- out.write(" ");
- out.write(emailAddress);
- out.write(" ");
- out.write(distinguisher);
- out.close();
- return set(PARAM_TYPE_PERSONALISATION, bout.toByteArray());
- }
- catch (IOException e)
- {
- throw new IllegalStateException("Byte I/O failed: " + e);
- }
- }
-
- /**
- * Implements the recommended personalisation format for Skein defined in Section 4.11 of
- * the Skein 1.3 specification. You may need to use this method if the default locale
- * doesn't use a Gregorian calender so that the GeneralizedTime produced is compatible implementations.
- * <p>
- * The format is <code>YYYYMMDD email@address distinguisher</code>, encoded to a byte
- * sequence using UTF-8 encoding.
- *
- * @param date the date the personalised application of the Skein was defined.
- * @param dateLocale locale to be used for date interpretation.
- * @param emailAddress the email address of the creation of the personalised application.
- * @param distinguisher an arbitrary personalisation string distinguishing the application.
- * @return the current builder.
- */
- public Builder setPersonalisation(Date date, Locale dateLocale, String emailAddress, String distinguisher)
- {
- try
- {
- final ByteArrayOutputStream bout = new ByteArrayOutputStream();
- final OutputStreamWriter out = new OutputStreamWriter(bout, "UTF-8");
- final DateFormat format = new SimpleDateFormat("YYYYMMDD", dateLocale);
- out.write(format.format(date));
- out.write(" ");
- out.write(emailAddress);
- out.write(" ");
- out.write(distinguisher);
- out.close();
- return set(PARAM_TYPE_PERSONALISATION, bout.toByteArray());
- }
- catch (IOException e)
- {
- throw new IllegalStateException("Byte I/O failed: " + e);
- }
- }
-
- /**
- * Sets the {@link SkeinParameters#PARAM_TYPE_KEY_IDENTIFIER} parameter.
- */
- public Builder setPublicKey(byte[] publicKey)
- {
- return set(PARAM_TYPE_PUBLIC_KEY, publicKey);
- }
-
- /**
- * Sets the {@link SkeinParameters#PARAM_TYPE_KEY_IDENTIFIER} parameter.
- */
- public Builder setKeyIdentifier(byte[] keyIdentifier)
- {
- return set(PARAM_TYPE_KEY_IDENTIFIER, keyIdentifier);
- }
-
- /**
- * Sets the {@link SkeinParameters#PARAM_TYPE_NONCE} parameter.
- */
- public Builder setNonce(byte[] nonce)
- {
- return set(PARAM_TYPE_NONCE, nonce);
- }
-
- /**
- * Constructs a new {@link SkeinParameters} instance with the parameters provided to this
- * builder.
- */
- public SkeinParameters build()
- {
- return new SkeinParameters(parameters);
- }
- }
-}
diff --git a/core/src/main/java/org/bouncycastle/crypto/params/TweakableBlockCipherParameters.java b/core/src/main/java/org/bouncycastle/crypto/params/TweakableBlockCipherParameters.java
deleted file mode 100644
index fa16facd..00000000
--- a/core/src/main/java/org/bouncycastle/crypto/params/TweakableBlockCipherParameters.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.util.Arrays;
-
-/**
- * Parameters for tweakable block ciphers.
- */
-public class TweakableBlockCipherParameters
- implements CipherParameters
-{
- private final byte[] tweak;
- private final KeyParameter key;
-
- public TweakableBlockCipherParameters(final KeyParameter key, final byte[] tweak)
- {
- this.key = key;
- this.tweak = Arrays.clone(tweak);
- }
-
- /**
- * Gets the key.
- *
- * @return the key to use, or <code>null</code> to use the current key.
- */
- public KeyParameter getKey()
- {
- return key;
- }
-
- /**
- * Gets the tweak value.
- *
- * @return the tweak to use, or <code>null</code> to use the current tweak.
- */
- public byte[] getTweak()
- {
- return tweak;
- }
-}