aboutsummaryrefslogtreecommitdiff
path: root/libjava/javax/crypto/spec
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2005-07-16 01:27:14 +0000
committerTom Tromey <tromey@gcc.gnu.org>2005-07-16 01:27:14 +0000
commitb0fa81eea9a270f23d6ad67ca7a6d25c18d20da1 (patch)
tree8762d1f992e2f725a6bde1ff966ed6f1e5f4f823 /libjava/javax/crypto/spec
parentea54b29342c8506acb4f858c68340c44b72e3532 (diff)
downloadgcc-b0fa81eea9a270f23d6ad67ca7a6d25c18d20da1.zip
gcc-b0fa81eea9a270f23d6ad67ca7a6d25c18d20da1.tar.gz
gcc-b0fa81eea9a270f23d6ad67ca7a6d25c18d20da1.tar.bz2
Major merge with Classpath.
Removed many duplicate files. * HACKING: Updated.x * classpath: Imported new directory. * standard.omit: New file. * Makefile.in, aclocal.m4, configure: Rebuilt. * sources.am: New file. * configure.ac: Run Classpath configure script. Moved code around to support. Disable xlib AWT peers (temporarily). * Makefile.am (SUBDIRS): Added 'classpath' (JAVAC): Removed. (AM_CPPFLAGS): Added more -I options. (BOOTCLASSPATH): Simplified. Completely redid how sources are built. Include sources.am. * include/Makefile.am (tool_include__HEADERS): Removed jni.h. * include/jni.h: Removed (in Classpath). * scripts/classes.pl: Updated to look at built classes. * scripts/makemake.tcl: New file. * testsuite/libjava.jni/jni.exp (gcj_jni_compile_c_to_so): Added -I options. (gcj_jni_invocation_compile_c_to_binary): Likewise. From-SVN: r102082
Diffstat (limited to 'libjava/javax/crypto/spec')
-rw-r--r--libjava/javax/crypto/spec/DESKeySpec.java220
-rw-r--r--libjava/javax/crypto/spec/DESedeKeySpec.java151
-rw-r--r--libjava/javax/crypto/spec/DHGenParameterSpec.java100
-rw-r--r--libjava/javax/crypto/spec/DHParameterSpec.java135
-rw-r--r--libjava/javax/crypto/spec/DHPrivateKeySpec.java115
-rw-r--r--libjava/javax/crypto/spec/DHPublicKeySpec.java115
-rw-r--r--libjava/javax/crypto/spec/IvParameterSpec.java96
-rw-r--r--libjava/javax/crypto/spec/PBEKeySpec.java176
-rw-r--r--libjava/javax/crypto/spec/PBEParameterSpec.java100
-rw-r--r--libjava/javax/crypto/spec/RC2ParameterSpec.java166
-rw-r--r--libjava/javax/crypto/spec/RC5ParameterSpec.java202
-rw-r--r--libjava/javax/crypto/spec/SecretKeySpec.java155
12 files changed, 0 insertions, 1731 deletions
diff --git a/libjava/javax/crypto/spec/DESKeySpec.java b/libjava/javax/crypto/spec/DESKeySpec.java
deleted file mode 100644
index 9075a77..0000000
--- a/libjava/javax/crypto/spec/DESKeySpec.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/* DESKeySpec -- Keys for DES.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package javax.crypto.spec;
-
-import java.security.InvalidKeyException;
-import java.security.spec.KeySpec;
-
-/**
- * This class is a transparent wrapper for DES keys, which are arrays
- * of 8 bytes.
- *
- * @author Casey Marshall (csm@gnu.org)
- * @since 1.4
- */
-public class DESKeySpec implements KeySpec
-{
-
- // Constants.
- // ------------------------------------------------------------------------
-
- /**
- * The length of a DES key, in bytes.
- */
- public static final int DES_KEY_LEN = 8;
-
- /**
- * The key bytes.
- */
- private byte[] key;
-
- // Constructors.
- // ------------------------------------------------------------------------
-
- /**
- * Create a new DES key spec, copying the first 8 bytes from the
- * byte array.
- *
- * @param key The key bytes.
- * @throws java.security.InvalidKeyException If there are less than 8
- * bytes in the array.
- */
- public DESKeySpec(byte[] key) throws InvalidKeyException
- {
- this(key, 0);
- }
-
- /**
- * Create a new DES key spec, starting at <code>offset</code> in
- * the byte array. The first 8 bytes starting at <code>offset</code>
- * are copied.
- *
- * @param key The key bytes.
- * @param offset The offset into the byte array at which to begin.
- * @throws java.security.InvalidKeyException If there are less than 8
- * bytes starting at <code>offset</code>.
- */
- public DESKeySpec(byte[] key, int offset) throws InvalidKeyException
- {
- if (key.length - offset < DES_KEY_LEN)
- {
- throw new InvalidKeyException("DES keys must be 8 bytes long");
- }
- this.key = new byte[DES_KEY_LEN];
- System.arraycopy(key, offset, this.key, 0, DES_KEY_LEN);
- }
-
- // Class methods.
- // ------------------------------------------------------------------------
-
- /**
- * Returns whether or not the given key is <i>parity adjusted</i>;
- * i.e. every byte in the key has an odd number of "1" bits.
- *
- * @param key The key bytes, considered between <code>[offset,
- * offset+7]</code>
- * @param offset The offset into the byte array at which to begin.
- * @return True if all bytes have an odd number of "1" bits.
- * @throws java.security.InvalidKeyException If there are not enough
- * bytes in the array.
- */
- public static boolean isParityAdjusted(byte[] key, int offset)
- throws InvalidKeyException
- {
- if (key.length - offset < DES_KEY_LEN)
- {
- throw new InvalidKeyException("DES keys must be 8 bytes long");
- }
- boolean parity = false;
- boolean oddbits = false;
- for (int i = 0; i < DES_KEY_LEN; i++)
- {
- oddbits = false;
- for (int j = 0; j < 8; j++)
- {
- oddbits ^= (key[i+offset] & 1 << j) != 0;
- }
- parity &= oddbits;
- }
- return parity;
- }
-
- /**
- * One-half of the weak and semiweak DES keys (the other half are the
- * complements of these).
- */
- private static final byte[][] WEAK_KEYS = new byte[][] {
- { 0, 0, 0, 0, 0, 0, 0, 0 }, // 0000 0000 0000 0000
- { -1, -1, -1, -1, 0, 0, 0, 0 }, // ffff ffff 0000 0000
- { 1, 1, 1, 1, 1, 1, 1, 1 }, // 0101 0101 0101 0101
- { 31, 31, 31, 31, 14, 14, 14, 14 }, // 1f1f 1f1f 0e0e 0e0e
- { 1, -2, 1, -2, 1, -2, 1, -2 }, // 01fe 01fe 01fe 01fe
- { 31, -32, 31, -32, -32, 31, -32, 31 }, // 1fe0 1fe0 0e1f 0e1f
- { 1, -32, 1, -32, 1, -15, 1, -15 }, // 01e0 01e0 01f1 01f1
- { 31, -2, 31, -2, 14, -2, 14, -2 }, // 1ffe 1ffe 0efe 0efe
- { 1, 31, 1, 31, 1, 14, 1, 14 }, // 011f 011f 010e 010e
- { -32, -2, -32, -2, -15, -2, -15, -2 }, // e0fe e0fe f1fe f1fe
- };
-
- /**
- * Tests if the bytes between <code>[offset, offset+7]</code>
- * constitute a weak or semi-weak DES key.
- *
- * @param key The key bytes to check.
- * @param offset The offset in the byte array to start.
- * @return true If the key bytes are a weak key.
- */
- public static boolean isWeak(byte[] key, int offset)
- throws InvalidKeyException
- {
- if (key.length - offset < DES_KEY_LEN)
- {
- throw new InvalidKeyException("DES keys must be 8 bytes long");
- }
- for (int i = 0; i < WEAK_KEYS.length; i++)
- {
- if (equalsOrComplementEquals(key, offset, WEAK_KEYS[i]))
- {
- return true;
- }
- }
- return false;
- }
-
- /**
- * This method returns true if the first 8 bytes starting at
- * <code>off</code> in <code>a</code> equal the first 8 bytes in
- * <code>b</code>, or equal the <i>complement</i> of the first 8 bytes
- * in <code>b</code>.
- *
- * @param a The first byte array.
- * @param off The index into the first byte array.
- * @param b The second byte array.
- * @return <code>a == b || a == ~b</code>
- */
- private static boolean equalsOrComplementEquals(byte[] a, int off, byte[] b)
- {
- boolean result = true;
- for (int i = 0; i < DES_KEY_LEN; i++)
- {
- result &= a[off+i] == b[i];
- }
- if (result) return true;
- result = true;
- for (int i = 0; i < DES_KEY_LEN; i++)
- {
- result &= a[off+i] == (~b[i]);
- }
- return result;
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
-
- /**
- * Return the key as a byte array. This method does not copy the byte
- * array.
- *
- * @return The key bytes.
- */
- public byte[] getKey()
- {
- return key;
- }
-}
diff --git a/libjava/javax/crypto/spec/DESedeKeySpec.java b/libjava/javax/crypto/spec/DESedeKeySpec.java
deleted file mode 100644
index 1f6a250..0000000
--- a/libjava/javax/crypto/spec/DESedeKeySpec.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/* DESedeKeySpec.java -- Keys for triple-DES.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package javax.crypto.spec;
-
-import java.security.InvalidKeyException;
-import java.security.spec.KeySpec;
-
-/**
- * This class is a transparent wrapper for DES-EDE (Triple-DES) keys,
- * which are arrays of 24 bytes.
- *
- * @author Casey Marshall (csm@gnu.org)
- * @since 1.4
- */
-public class DESedeKeySpec implements KeySpec
-{
-
- // Constants.
- // ------------------------------------------------------------------------
-
- /**
- * The length of a triple-DES key, in bytes.
- */
- public static final int DES_EDE_KEY_LEN = 24;
-
- /**
- * The key bytes.
- */
- private byte[] key;
-
- // Constructors.
- // ------------------------------------------------------------------------
-
- /**
- * Create a new DES-EDE key spec, copying the first 24 bytes from the
- * byte array.
- *
- * @param key The key bytes.
- * @throws java.security.InvalidKeyException If there are less than 24
- * bytes in the array.
- */
- public DESedeKeySpec(byte[] key) throws InvalidKeyException
- {
- this(key, 0);
- }
-
- /**
- * Create a new DES-EDE key spec, starting at <code>offset</code> in
- * the byte array. The first 24 bytes starting at <code>offset</code>
- * are copied.
- *
- * @param key The key bytes.
- * @param offset The offset into the byte array at which to begin.
- * @throws java.security.InvalidKeyException If there are less than 24
- * bytes starting at <code>offset</code>.
- */
- public DESedeKeySpec(byte[] key, int offset) throws InvalidKeyException
- {
- if (key.length - offset < DES_EDE_KEY_LEN)
- {
- throw new InvalidKeyException("DES-EDE keys must be 24 bytes long");
- }
- this.key = new byte[DES_EDE_KEY_LEN];
- System.arraycopy(key, offset, this.key, 0, DES_EDE_KEY_LEN);
- }
-
- // Class methods.
- // ------------------------------------------------------------------------
-
- /**
- * Returns whether or not the given key is <i>parity adjusted</i>;
- * i.e. every byte in the key has an odd number of "1" bits.
- *
- * @param key The key bytes, considered between <code>[offset,
- * offset+23]</code>
- * @param offset The offset into the byte array at which to begin.
- * @return True if all bytes have an odd number of "1" bits.
- * @throws java.security.InvalidKeyException If there are not enough
- * bytes in the array.
- */
- public static boolean isParityAdjusted(byte[] key, int offset)
- throws InvalidKeyException
- {
- if (key.length - offset < DES_EDE_KEY_LEN)
- {
- throw new InvalidKeyException("DES-EDE keys must be 24 bytes long");
- }
- boolean parity = false;
- boolean oddbits = false;
- for (int i = 0; i < DES_EDE_KEY_LEN; i++)
- {
- oddbits = false;
- for (int j = 0; j < 8; j++)
- {
- oddbits ^= (key[i+offset] & 1 << j) != 0;
- }
- parity &= oddbits;
- }
- return parity;
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
-
- /**
- * Return the key as a byte array. This method does not copy the byte
- * array.
- *
- * @return The key bytes.
- */
- public byte[] getKey()
- {
- return key;
- }
-}
diff --git a/libjava/javax/crypto/spec/DHGenParameterSpec.java b/libjava/javax/crypto/spec/DHGenParameterSpec.java
deleted file mode 100644
index 0fc8ed5..0000000
--- a/libjava/javax/crypto/spec/DHGenParameterSpec.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/* DHGenParameterSpec.java -- Diffie-Hellman parameter generator spec.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package javax.crypto.spec;
-
-import java.security.spec.AlgorithmParameterSpec;
-
-/**
- * This class represents the parameters needed for generating
- * Diffie-Hellman parameters.
- *
- * @author Casey Marshall (csm@gnu.org)
- * @since 1.4
- * @see DHParameterSpec
- */
-public class DHGenParameterSpec implements AlgorithmParameterSpec
-{
-
- // Variables.
- // ------------------------------------------------------------------------
-
- /** The length of the prime, in bits. */
- private int primeSize;
-
- /** The length of the exponent, in bits. */
- private int exponentSize;
-
- // Constructor.
- // ------------------------------------------------------------------------
-
- /**
- * Create a new Diffie-Hellman parameter generator spec.
- *
- * @param primeSize The size of the prime, in bits.
- * @param exponentSize The size of the exponent, in bits.
- */
- public DHGenParameterSpec(int primeSize, int exponentSize)
- {
- this.primeSize = primeSize;
- this.exponentSize = exponentSize;
- }
-
- // Intance methods.
- // ------------------------------------------------------------------------
-
- /**
- * Get the size of the exponent, in bits.
- *
- * @return The exponent size.
- */
- public int getExponentSize()
- {
- return exponentSize;
- }
-
- /**
- * Get the size of the prime, in bits.
- *
- * @return The prime size.
- */
- public int getPrimeSize()
- {
- return primeSize;
- }
-}
diff --git a/libjava/javax/crypto/spec/DHParameterSpec.java b/libjava/javax/crypto/spec/DHParameterSpec.java
deleted file mode 100644
index 4db8287..0000000
--- a/libjava/javax/crypto/spec/DHParameterSpec.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/* DHParameterSpec.java -- Parameters for Diffie-Hellman keys.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package javax.crypto.spec;
-
-import java.math.BigInteger;
-import java.security.spec.AlgorithmParameterSpec;
-
-/**
- * The base set of parameters necessary to perform Diffie-Hellman key
- * exchange. Each party in the key exchange shares these parameters.
- *
- * <p>Each set of parameters consists of a <i>base generator</i>
- * <code>g</code>, a <i>prime modulus</i> <code>p</code>, and an
- * optional length, in bits, of the private exponent.
- *
- * <p>See <a href="http://www.rsasecurity.com/rsalabs/pkcs/pkcs-3/">PKCS
- * #3 - Diffie-Hellman Key Agreement Standard</a> for more information.
- *
- * @author Casey Marshall (csm@gnu.org)
- * @since 1.4
- * @see javax.crypto.KeyAgreement
- */
-public class DHParameterSpec implements AlgorithmParameterSpec
-{
-
- // Variables.
- // ------------------------------------------------------------------------
-
- /** The base generator g. */
- private BigInteger g;
-
- /** The prime modulus p. */
- private BigInteger p;
-
- /** The length, in bits, of the private exponent. */
- private int l;
-
- // Constructors.
- // ------------------------------------------------------------------------
-
- /**
- * Create a new set of Diffie-Hellman parameters.
- *
- * @param p The prime modulus.
- * @param g The base generator.
- */
- public DHParameterSpec(BigInteger p, BigInteger g)
- {
- this(p, g, 0);
- }
-
- /**
- * Create a new set of Diffie-Hellman parameters.
- *
- * @param p The prime modulus.
- * @param g The base generator.
- * @param l The size of the private exponent, in bits.
- */
- public DHParameterSpec(BigInteger p, BigInteger g, int l)
- {
- this.p = p;
- this.g = g;
- this.l = l;
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
-
- /**
- * Get the base generator, <i>g</i>.
- *
- * @return The base generator <i>g</i>.
- */
- public BigInteger getG()
- {
- return g;
- }
-
- /**
- * Get the length of the private exponent, in bits.
- *
- * @return The length of the private exponent, in bits, or 0 if this
- * has not been explicitly set.
- */
- public int getL()
- {
- return l;
- }
-
- /**
- * Get the prime modulus, <i>p</i>.
- *
- * @return The prime modulus, <i>p</i>.
- */
- public BigInteger getP()
- {
- return p;
- }
-}
diff --git a/libjava/javax/crypto/spec/DHPrivateKeySpec.java b/libjava/javax/crypto/spec/DHPrivateKeySpec.java
deleted file mode 100644
index 348a192..0000000
--- a/libjava/javax/crypto/spec/DHPrivateKeySpec.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/* DHPrivateKeySpec.java -- Wrapper for Diffie-Hellman private keys.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package javax.crypto.spec;
-
-import java.math.BigInteger;
-import java.security.spec.KeySpec;
-
-/**
- * A wrapper for Diffie-Hellman private key data.
- *
- * @author Casey Marshall (csm@gnu.org)
- * @since 1.4
- * @see DHPublicKeySpec
- */
-public class DHPrivateKeySpec implements KeySpec
-{
-
- // Variables.
- // ------------------------------------------------------------------------
-
- /** The base generator. */
- private BigInteger g;
-
- /** The prime modulus. */
- private BigInteger p;
-
- /** The private exponent. */
- private BigInteger x;
-
- // Constructors.
- // ------------------------------------------------------------------------
-
- /**
- * Create a new Diffie-Hellman private key spec.
- *
- * @param x The private exponent.
- * @param p The prime modulus.
- * @param g The base generator.
- */
- public DHPrivateKeySpec(BigInteger x, BigInteger p, BigInteger g)
- {
- this.x = x;
- this.p = p;
- this.g = g;
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
-
- /**
- * Get the base generator.
- *
- * @return The base generator.
- */
- public BigInteger getG()
- {
- return g;
- }
-
- /**
- * Get the prime modulus.
- *
- * @return The prime modulus.
- */
- public BigInteger getP()
- {
- return p;
- }
-
- /**
- * Get the private exponent.
- *
- * @return The private exponent.
- */
- public BigInteger getX()
- {
- return x;
- }
-}
diff --git a/libjava/javax/crypto/spec/DHPublicKeySpec.java b/libjava/javax/crypto/spec/DHPublicKeySpec.java
deleted file mode 100644
index e818727..0000000
--- a/libjava/javax/crypto/spec/DHPublicKeySpec.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/* DHPublicKeySpec.java -- Wrapper for Diffie-Hellman public keys.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package javax.crypto.spec;
-
-import java.math.BigInteger;
-import java.security.spec.KeySpec;
-
-/**
- * A wrapper for Diffie-Hellman public key data.
- *
- * @author Casey Marshall (csm@gnu.org)
- * @since 1.4
- * @see DHPrivateKeySpec
- */
-public class DHPublicKeySpec implements KeySpec
-{
-
- // Variables.
- // ------------------------------------------------------------------------
-
- /** The base generator. */
- private BigInteger g;
-
- /** The prime modulus. */
- private BigInteger p;
-
- /** The public value. */
- private BigInteger y;
-
- // Constructors.
- // ------------------------------------------------------------------------
-
- /**
- * Create a new Diffie-Hellman public key spec.
- *
- * @param y The public value.
- * @param p The prime modulus.
- * @param g The base generator.
- */
- public DHPublicKeySpec(BigInteger y, BigInteger p, BigInteger g)
- {
- this.y = y;
- this.p = p;
- this.g = g;
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
-
- /**
- * Get the base generator.
- *
- * @return The base generator.
- */
- public BigInteger getG()
- {
- return g;
- }
-
- /**
- * Get the prime modulus.
- *
- * @return The prime modulus.
- */
- public BigInteger getP()
- {
- return p;
- }
-
- /**
- * Get the public value.
- *
- * @return The public value.
- */
- public BigInteger getY()
- {
- return y;
- }
-}
diff --git a/libjava/javax/crypto/spec/IvParameterSpec.java b/libjava/javax/crypto/spec/IvParameterSpec.java
deleted file mode 100644
index 3af38f5..0000000
--- a/libjava/javax/crypto/spec/IvParameterSpec.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/* IvParameterSpec.java -- A simple wrapper for initialization vectors.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package javax.crypto.spec;
-
-import java.security.spec.AlgorithmParameterSpec;
-
-/**
- * A wrapper for an initialization vector. An initialization vector is
- * necessary for any cipher in any <i>feedback mode</i>, e.g. CBC.
- *
- * @author Casey Marshall (csm@gnu.org)
- */
-public class IvParameterSpec implements AlgorithmParameterSpec
-{
-
- // Fields.
- // ------------------------------------------------------------------------
-
- /** The IV. */
- private byte[] iv;
-
- // Constructors.
- // ------------------------------------------------------------------------
-
- /**
- * Create a new initialization vector spec from an entire byte array.
- *
- * @param iv The IV bytes.
- */
- public IvParameterSpec(byte[] iv)
- {
- this(iv, 0, iv.length);
- }
-
- /**
- * Create a new initialization vector spec from part of a byte array.
- *
- * @param iv The IV bytes.
- * @param off The offset into the IV bytes.
- * @param len The number of IV bytes.
- */
- public IvParameterSpec(byte[] iv, int off, int len)
- {
- this.iv = new byte[len];
- System.arraycopy(iv, off, this.iv, 0, len);
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
-
- /**
- * Returns the IV. This method does not copy the byte array.
- *
- * @return The IV.
- */
- public byte[] getIV()
- {
- return iv;
- }
-}
diff --git a/libjava/javax/crypto/spec/PBEKeySpec.java b/libjava/javax/crypto/spec/PBEKeySpec.java
deleted file mode 100644
index d17dc41..0000000
--- a/libjava/javax/crypto/spec/PBEKeySpec.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/* PBEKeySpec.java -- Wrapper for password-based keys.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package javax.crypto.spec;
-
-import java.security.spec.KeySpec;
-
-/**
- * A wrapper for a password-based key, used for password-based
- * encryption (PBE).
- *
- * <p>Examples of password-based encryption algorithms include:
- *
- * <ul>
- * <li><a href="http://www.rsasecurity.com/rsalabs/pkcs/pkcs-5/">PKCS #5
- * - Password-Based Cryptography Standard</a></li>
- * <li><a href="http://www.rsasecurity.com/rsalabs/pkcs/pkcs-12/">PKCS
- * #12 - Personal Information Exchange Syntax Standard</a></li>
- * </ul>
- *
- * @author Casey Marshall (csm@gnu.org)
- * @since 1.4
- * @see javax.crypto.SecretKeyFactory
- * @see PBEParameterSpec
- */
-public class PBEKeySpec implements KeySpec
-{
-
- // Fields.
- // ------------------------------------------------------------------------
-
- /** The iteration count. */
- private int iterationCount;
-
- /** The generated key length. */
- private int keyLength;
-
- /** The password. */
- private char[] password;
-
- /** The salt. */
- private byte[] salt;
-
- // Constructors.
- // ------------------------------------------------------------------------
-
- /**
- * Create a new PBE key spec with just a password.
- *
- * @param password The password char array.
- */
- public PBEKeySpec(char[] password)
- {
- this(password, null, 0, 0);
- }
-
- /**
- * Create a PBE key spec with a password, salt, and iteration count.
- *
- * @param password The password char array.
- * @param salt The salt bytes.
- * @param iterationCount The iteration count.
- */
- public PBEKeySpec(char[] password, byte[] salt, int iterationCount)
- {
- this(password, salt, iterationCount, 0);
- }
-
- /**
- * Create a PBE key spec with a password, salt, iteration count, and
- * key length.
- *
- * @param password The password char array.
- * @param salt The salt bytes.
- * @param iterationCount The iteration count.
- * @param keyLength The generated key length.
- */
- public PBEKeySpec(char[] password, byte[] salt, int iterationCount,
- int keyLength)
- {
- this.password = password;
- this.salt = salt;
- this.iterationCount = iterationCount;
- this.keyLength = keyLength;
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
-
- /**
- * Clear the password array by filling it with null characters.
- */
- public final void clearPassword()
- {
- if (password == null) return;
- for (int i = 0; i < password.length; i++)
- {
- password[i] = '\u0000';
- }
- }
-
- /**
- * Get the iteration count, or 0 if it has not been specified.
- *
- * @return The iteration count, or 0 if it has not been specified.
- */
- public final int getIterationCount()
- {
- return iterationCount;
- }
-
- /**
- * Get the generated key length, or 0 if it has not been specified.
- *
- * @return The key length, or 0 if it has not been specified.
- */
- public final int getKeyLength()
- {
- return keyLength;
- }
-
- /**
- * Get the password character array.
- *
- * @return The password.
- */
- public final char[] getPassword()
- {
- return password;
- }
-
- /**
- * Get the salt bytes.
- *
- * @return The salt.
- */
- public final byte[] getSalt()
- {
- return salt;
- }
-}
diff --git a/libjava/javax/crypto/spec/PBEParameterSpec.java b/libjava/javax/crypto/spec/PBEParameterSpec.java
deleted file mode 100644
index 322d955..0000000
--- a/libjava/javax/crypto/spec/PBEParameterSpec.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/* PBEParameterSpec.java -- A wrapper for PBE parameters.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package javax.crypto.spec;
-
-import java.security.spec.AlgorithmParameterSpec;
-
-/**
- * A wrapper for the parameters used in <a
- * href="http://www.rsasecurity.com/rsalabs/pkcs/pkcs-5/">PKCS #5 -
- * Password-Based Cryptography Standard</a>.
- *
- * @author Casey Marshall (csm@gnu.org)
- * @since 1.4
- */
-public class PBEParameterSpec implements AlgorithmParameterSpec
-{
-
- // Fields.
- // ------------------------------------------------------------------------
-
- /** The iteration count. */
- private int iterationCount;
-
- /** The salt. */
- private byte[] salt;
-
- // Constructor.
- // ------------------------------------------------------------------------
-
- /**
- * Creates a new password-based encryption parameter specification.
- *
- * @param salt The salt.
- * @param iterationCount The iteration count.
- */
- public PBEParameterSpec(byte[] salt, int iterationCount)
- {
- this.salt = salt;
- this.iterationCount = iterationCount;
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
-
- /**
- * Get the iteration count.
- *
- * @return The iteration count.
- */
- public int getIterationCount()
- {
- return iterationCount;
- }
-
- /**
- * Get the salt.
- *
- * @return The salt.
- */
- public byte[] getSalt()
- {
- return salt;
- }
-}
diff --git a/libjava/javax/crypto/spec/RC2ParameterSpec.java b/libjava/javax/crypto/spec/RC2ParameterSpec.java
deleted file mode 100644
index 33155b2..0000000
--- a/libjava/javax/crypto/spec/RC2ParameterSpec.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/* RC2ParameterSpec.java -- Wrapper for RC2 parameters.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package javax.crypto.spec;
-
-import java.security.spec.AlgorithmParameterSpec;
-
-/**
- * A wrapper for parameters for the <a
- * href="http://www.rsasecurity.com/rsalabs/faq/3-6-2.html">RC2</a>
- * block cipher ("RC" means either "Rivest Cipher" or "Ron's Code",
- * depending upon who you ask and when).
- *
- * @author Casey Marshall (csm@gnu.org)
- * @since 1.4
- */
-public class RC2ParameterSpec implements AlgorithmParameterSpec
-{
-
- // Constants and fields.
- // ------------------------------------------------------------------------
-
- /** The length of an RC2 IV, in bytes. */
- private static final int RC2_IV_LENGTH = 8;
-
- /** The effective key length, in bits. */
- private int effectiveKeyBits;
-
- /** The initialization vector. */
- private byte[] iv;
-
- // Constructors.
- // ------------------------------------------------------------------------
-
- /**
- * Create RC2 parameters without an IV.
- *
- * @param effectiveKeyBits The number of effective key bits.
- */
- public RC2ParameterSpec(int effectiveKeyBits)
- {
- this.effectiveKeyBits = effectiveKeyBits;
- }
-
- /**
- * Create RC2 parameters with an IV.
- *
- * @param effectiveKeyBits The number of effective key bits.
- * @param iv The IV; the first eight bytes of this array
- * are used.
- */
- public RC2ParameterSpec(int effectiveKeyBits, byte[] iv)
- {
- this(effectiveKeyBits, iv, 0);
- }
-
- /**
- * Create RC2 parameters with an IV.
- *
- * @param effectiveKeyBits The number of effective key bits.
- * @param iv The IV; the first eight bytes of this array
- * after <code>offset</code> are used.
- * @param offset From whence to start in the array.
- */
- public RC2ParameterSpec(int effectiveKeyBits, byte[] iv, int offset)
- {
- if (iv.length - offset < RC2_IV_LENGTH)
- {
- throw new IllegalArgumentException("IV too short");
- }
- this.effectiveKeyBits = effectiveKeyBits;
- this.iv = new byte[RC2_IV_LENGTH];
- System.arraycopy(iv, offset, this.iv, 0, RC2_IV_LENGTH);
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
-
- /**
- * Get the number of effective key bits.
- *
- * @return The numer of effective key bits.
- */
- public int getEffectiveKeyBits()
- {
- return effectiveKeyBits;
- }
-
- /**
- * Return the initialization vector, or <code>null</code> if none was
- * specified.
- *
- * @return The IV, or null.
- */
- public byte[] getIV()
- {
- return iv;
- }
-
- public boolean equals(Object o)
- {
- if (this == o) return true;
- byte[] oiv = ((RC2ParameterSpec) o).getIV();
- if (iv != oiv)
- {
- if (iv == null || oiv == null) return false;
- if (iv.length != oiv.length) return false;
- for (int i = 0; i < iv.length; i++)
- {
- if (iv[i] != oiv[i])
- {
- return false;
- }
- }
- }
- return effectiveKeyBits == ((RC2ParameterSpec) o).getEffectiveKeyBits();
- }
-
- public int hashCode()
- {
- int code = effectiveKeyBits;
- if (iv != null)
- {
- for (int i = 0; i < RC2_IV_LENGTH; i++)
- {
- code += iv[i];
- }
- }
- return code;
- }
-}
diff --git a/libjava/javax/crypto/spec/RC5ParameterSpec.java b/libjava/javax/crypto/spec/RC5ParameterSpec.java
deleted file mode 100644
index 8570c86..0000000
--- a/libjava/javax/crypto/spec/RC5ParameterSpec.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/* RC5ParameterSpec.java -- parameters for RC5.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package javax.crypto.spec;
-
-import java.security.spec.AlgorithmParameterSpec;
-
-/**
- * A wrapper for parameters to the <a
- * href="http://www.rsasecurity.com/rsalabs/faq/3-6-4.html">RC5</a>
- * block cipher.
- *
- * @author Casey Marshall (csm@gnu.org)
- * @since 1.4
- */
-public class RC5ParameterSpec implements AlgorithmParameterSpec
-{
-
- // Fields.
- // ------------------------------------------------------------------------
-
- /** The IV. */
- private byte[] iv;
-
- /** The number of rounds. */
- private int rounds;
-
- /** The version number. */
- private int version;
-
- /** The word size, in bits. */
- private int wordSize;
-
- // Constructors.
- // ------------------------------------------------------------------------
-
- /**
- * Create RC5 parameters without an IV.
- *
- * @param version The version number.
- * @param rounds The number of rounds.
- * @param wordSize The size of a word, in bits.
- */
- public RC5ParameterSpec(int version, int rounds, int wordSize)
- {
- this.version = version;
- this.rounds = rounds;
- this.wordSize = wordSize;
- }
-
- /**
- * Create RC5 parameters with an IV. The bytes in <code>iv</code> in
- * the range <code>[0, 2*(wordSize/8)-1]</code> are used.
- *
- * @param version The version number.
- * @param rounds The number of rounds.
- * @param wordSize The size of a word, in bits.
- * @param iv The IV data.
- */
- public RC5ParameterSpec(int version, int rounds, int wordSize, byte[] iv)
- {
- this(version, rounds, wordSize, iv, 0);
- }
-
- /**
- * Create RC5 parameters with an IV. The bytes in <code>iv</code> in
- * the range <code>[off, off+2*(wordSize/8)-1]</code> are used.
- *
- * @param version The version number.
- * @param rounds The number of rounds.
- * @param wordSize The size of a word, in bits.
- * @param iv The IV data.
- * @param off From where in the array the IV starts.
- */
- public
- RC5ParameterSpec(int version, int rounds, int wordSize, byte[] iv, int off)
- {
- this(version, rounds, wordSize);
- int ivLength = 2 * (wordSize / 8);
- if (off < 0)
- throw new IllegalArgumentException();
- if (iv.length - off < ivLength)
- {
- throw new IllegalArgumentException("IV too short");
- }
- this.iv = new byte[ivLength];
- System.arraycopy(iv, off, this.iv, 0, ivLength);
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
-
- /**
- * Return the initializaiton vector, or <code>null</code> if none was
- * specified.
- *
- * @return The IV, or null.
- */
- public byte[] getIV()
- {
- return iv;
- }
-
- /**
- * Get the number of rounds.
- *
- * @return The number of rounds.
- */
- public int getRounds()
- {
- return rounds;
- }
-
- /**
- * Get the version number.
- *
- * @return The version number.
- */
- public int getVersion()
- {
- return version;
- }
-
- /**
- * Get the word size, in bits.
- *
- * @return The word size, in bits.
- */
- public int getWordSize()
- {
- return wordSize;
- }
-
- public boolean equals(Object o)
- {
- if (this == o) return true;
- byte[] oiv = ((RC5ParameterSpec) o).getIV();
- if (iv != oiv)
- {
- if (iv == null || oiv == null) return false;
- if (iv.length != oiv.length) return false;
- for (int i = 0; i < iv.length; i++)
- {
- if (iv[i] != oiv[i])
- {
- return false;
- }
- }
- }
- return rounds == ((RC5ParameterSpec) o).getRounds()
- && version == ((RC5ParameterSpec) o).getVersion()
- && wordSize == ((RC5ParameterSpec) o).getWordSize();
- }
-
- public int hashCode()
- {
- int code = rounds + version + wordSize;
- if (iv != null)
- {
- for (int i = 0; i < iv.length; i++)
- {
- code += iv[i];
- }
- }
- return code;
- }
-}
diff --git a/libjava/javax/crypto/spec/SecretKeySpec.java b/libjava/javax/crypto/spec/SecretKeySpec.java
deleted file mode 100644
index 4caf51a..0000000
--- a/libjava/javax/crypto/spec/SecretKeySpec.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/* SecretKeySpec.java -- Wrapper for secret keys.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package javax.crypto.spec;
-
-import java.security.spec.KeySpec;
-
-import javax.crypto.SecretKey;
-
-/**
- * This is a simple wrapper around a raw byte array, for ciphers that do
- * not require any key parameters other than the bytes themselves.
- *
- * <p>Since this class implements {@link javax.crypto.SecretKey}, which
- * in turn extends {@link java.security.Key}, so instances of this class
- * may be passed directly to the <code>init()</code> methods of {@link
- * javax.crypto.Cipher}.
- *
- * @see javax.crypto.SecretKey
- * @see javax.crypto.SecretKeyFactory
- */
-public class SecretKeySpec implements KeySpec, SecretKey
-{
-
- // Constants and fields.
- // ------------------------------------------------------------------------
-
- /** Compatible with JDK1.4. */
- private static final long serialVersionUID = 6577238317307289933L;
-
- /** The key bytes. */
- private byte[] key;
-
- /** The algorithm's name. */
- private String algorithm;
-
- // Constructors.
- // ------------------------------------------------------------------------
-
- /**
- * Create a new secret key spec from an entire byte array.
- *
- * @param key The key material.
- * @param algorithm The name of the algorithm using this key.
- */
- public SecretKeySpec(byte[] key, String algorithm)
- {
- this(key, 0, key.length, algorithm);
- }
-
- /**
- * Create a new secret key spec from part of a byte array.
- *
- * @param key The key material.
- * @param off The offset at which key material begins.
- * @param len The length of key material.
- * @param algorithm The name of the algorithm using this key.
- */
- public SecretKeySpec(byte[] key, int off, int len, String algorithm)
- {
- this.key = new byte[len];
- this.algorithm = algorithm;
- System.arraycopy(key, off, this.key, 0, len);
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
-
- /**
- * Return the name of the algorithm associated with this secret key.
- *
- * @return The algorithm's name.
- */
- public String getAlgorithm()
- {
- return algorithm;
- }
-
- /**
- * Return the key as a byte array.
- *
- * @return The key material.
- */
- public byte[] getEncoded()
- {
- return key;
- }
-
- /**
- * This key's format, which is always "RAW".
- *
- * @return "RAW"
- */
- public String getFormat()
- {
- return "RAW";
- }
-
- public boolean equals(Object o)
- {
- byte[] okey = ((SecretKeySpec) o).getEncoded();
- if (key.length != okey.length) return false;
- for (int i = 0; i < key.length; i++)
- {
- if (key[i] != okey[i])
- return false;
- }
- return algorithm.equals(((SecretKeySpec) o).getAlgorithm());
- }
-
- public int hashCode()
- {
- int code = 0;
- for (int i = 0; i < key.length; i++)
- {
- code ^= (key[i] & 0xff) << (i << 3 & 31);
- }
- return code ^ algorithm.hashCode();
- }
-}