summaryrefslogtreecommitdiffstats
path: root/bcprov/src/main/java/org/bouncycastle/jcajce/spec/GOST28147ParameterSpec.java
diff options
context:
space:
mode:
authorSergio Giro <sgiro@google.com>2016-02-01 18:54:35 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-02-01 18:54:35 +0000
commit3e75bd6b407dd472c834a50f16aae54cca67ea9c (patch)
treeb5eb091b97b2aade28e5b45a15352125a4a776d7 /bcprov/src/main/java/org/bouncycastle/jcajce/spec/GOST28147ParameterSpec.java
parent9218edabd1ef9852bc2f13115dcadc81b442dd6c (diff)
parentc1040cb5656c3299f1c2d0fe0bd7c44b10466aaf (diff)
downloadandroid_external_bouncycastle-3e75bd6b407dd472c834a50f16aae54cca67ea9c.tar.gz
android_external_bouncycastle-3e75bd6b407dd472c834a50f16aae54cca67ea9c.tar.bz2
android_external_bouncycastle-3e75bd6b407dd472c834a50f16aae54cca67ea9c.zip
Merge "Restoring the contents of aosp after"
Diffstat (limited to 'bcprov/src/main/java/org/bouncycastle/jcajce/spec/GOST28147ParameterSpec.java')
-rw-r--r--bcprov/src/main/java/org/bouncycastle/jcajce/spec/GOST28147ParameterSpec.java108
1 files changed, 0 insertions, 108 deletions
diff --git a/bcprov/src/main/java/org/bouncycastle/jcajce/spec/GOST28147ParameterSpec.java b/bcprov/src/main/java/org/bouncycastle/jcajce/spec/GOST28147ParameterSpec.java
deleted file mode 100644
index be341c4..0000000
--- a/bcprov/src/main/java/org/bouncycastle/jcajce/spec/GOST28147ParameterSpec.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.bouncycastle.jcajce.spec;
-
-import java.security.spec.AlgorithmParameterSpec;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.bouncycastle.asn1.ASN1ObjectIdentifier;
-import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers;
-import org.bouncycastle.crypto.engines.GOST28147Engine;
-import org.bouncycastle.util.Arrays;
-
-/**
- * A parameter spec for the GOST-28147 cipher.
- */
-public class GOST28147ParameterSpec
- implements AlgorithmParameterSpec
-{
- private byte[] iv = null;
- private byte[] sBox = null;
-
- public GOST28147ParameterSpec(
- byte[] sBox)
- {
- this.sBox = new byte[sBox.length];
-
- System.arraycopy(sBox, 0, this.sBox, 0, sBox.length);
- }
-
- public GOST28147ParameterSpec(
- byte[] sBox,
- byte[] iv)
- {
- this(sBox);
- this.iv = new byte[iv.length];
-
- System.arraycopy(iv, 0, this.iv, 0, iv.length);
- }
-
- public GOST28147ParameterSpec(
- String sBoxName)
- {
- this.sBox = GOST28147Engine.getSBox(sBoxName);
- }
-
- public GOST28147ParameterSpec(
- String sBoxName,
- byte[] iv)
- {
- this(sBoxName);
- this.iv = new byte[iv.length];
-
- System.arraycopy(iv, 0, this.iv, 0, iv.length);
- }
-
- public GOST28147ParameterSpec(
- ASN1ObjectIdentifier sBoxName,
- byte[] iv)
- {
- this(getName(sBoxName));
- this.iv = Arrays.clone(iv);
- }
-
- public byte[] getSbox()
- {
- return sBox;
- }
-
- /**
- * Returns the IV or null if this parameter set does not contain an IV.
- *
- * @return the IV or null if this parameter set does not contain an IV.
- */
- public byte[] getIV()
- {
- if (iv == null)
- {
- return null;
- }
-
- byte[] tmp = new byte[iv.length];
-
- System.arraycopy(iv, 0, tmp, 0, tmp.length);
-
- return tmp;
- }
-
- private static Map oidMappings = new HashMap();
-
- static
- {
- oidMappings.put(CryptoProObjectIdentifiers.id_Gost28147_89_CryptoPro_A_ParamSet, "E-A");
- oidMappings.put(CryptoProObjectIdentifiers.id_Gost28147_89_CryptoPro_B_ParamSet, "E-B");
- oidMappings.put(CryptoProObjectIdentifiers.id_Gost28147_89_CryptoPro_C_ParamSet, "E-C");
- oidMappings.put(CryptoProObjectIdentifiers.id_Gost28147_89_CryptoPro_D_ParamSet, "E-D");
- }
-
- private static String getName(ASN1ObjectIdentifier sBoxOid)
- {
- String sBoxName = (String)oidMappings.get(sBoxOid);
-
- if (sBoxName == null)
- {
- throw new IllegalArgumentException("unknown OID: " + sBoxOid);
- }
-
- return sBoxName;
- }
-} \ No newline at end of file