You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2006/10/27 05:44:24 UTC
svn commit: r468250 - in
/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src:
main/java/javax/crypto/ main/java/javax/crypto/spec/
main/java/org/apache/harmony/crypto/internal/
main/java/org/apache/harmony/crypto/utils/ test/support/common/ja...
Author: ndbeyer
Date: Thu Oct 26 20:44:22 2006
New Revision: 468250
URL: http://svn.apache.org/viewvc?view=rev&rev=468250
Log:
Cleanup compiler warnings; missing annotations, missing type variables, etc
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/Cipher.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/CipherInputStream.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/CipherOutputStream.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/EncryptedPrivateKeyInfo.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/ExemptionMechanism.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/KeyAgreement.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/KeyGenerator.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/Mac.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/MacSpi.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/SecretKeyFactory.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/SecretKeyFactorySpi.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/RC2ParameterSpec.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/RC5ParameterSpec.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/SecretKeySpec.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/org/apache/harmony/crypto/internal/NullCipherSpi.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/org/apache/harmony/crypto/utils/AlgNameMapper.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/EncryptedPrivateKeyInfoData.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyCipher.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyExemptionMechanismSpi.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyKeyAgreementSpi.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyKeyGeneratorSpi.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyMacSpi.java
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MySecretKeyFactorySpi.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/Cipher.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/Cipher.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/Cipher.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/Cipher.java Thu Oct 26 20:44:22 2006
@@ -36,7 +36,6 @@
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.security.spec.AlgorithmParameterSpec;
-import java.util.Iterator;
import java.util.Set;
import java.util.StringTokenizer;
@@ -102,7 +101,7 @@
/**
* Used to access common engine functionality
*/
- private static Engine engine = new Engine(SERVICE);
+ private static final Engine engine = new Engine(SERVICE);
/**
* The provider
@@ -476,11 +475,10 @@
throw new InvalidParameterException(Messages.getString("crypto.19")); //$NON-NLS-1$
}
if (certificate instanceof X509Certificate) {
- Set ce = ((X509Certificate) certificate).getCriticalExtensionOIDs();
+ Set<String> ce = ((X509Certificate) certificate).getCriticalExtensionOIDs();
boolean critical = false;
if (ce != null && !ce.isEmpty()) {
- for (Iterator i = ce.iterator(); i.hasNext();) {
- String oid = (String) i.next();
+ for (String oid : ce) {
if (oid.equals("2.5.29.15")) { //KeyUsage OID = 2.5.29.15 //$NON-NLS-1$
critical = true;
break;
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/CipherInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/CipherInputStream.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/CipherInputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/CipherInputStream.java Thu Oct 26 20:44:22 2006
@@ -34,8 +34,8 @@
public class CipherInputStream extends FilterInputStream {
private final Cipher cipher;
- private int I_BUFFER_SIZE = 20;
- private byte[] i_buffer = new byte[I_BUFFER_SIZE];
+ private final int I_BUFFER_SIZE = 20;
+ private final byte[] i_buffer = new byte[I_BUFFER_SIZE];
private int index; // index of the butes to return from o_buffer
private byte[] o_buffer;
private boolean finished;
@@ -58,6 +58,7 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public int read() throws IOException {
if (finished) {
return ((o_buffer == null) || (index == o_buffer.length))
@@ -88,6 +89,7 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public int read(byte[] b) throws IOException {
return read(b, 0, b.length);
}
@@ -95,6 +97,7 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public int read(byte[] b, int off, int len) throws IOException {
if (in == null) {
throw new NullPointerException("Underlying input stream is null");
@@ -116,6 +119,7 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public long skip(long n) throws IOException {
long i = 0;
int available = available();
@@ -131,6 +135,7 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public int available() throws IOException {
return 0;
}
@@ -138,6 +143,7 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public void close() throws IOException {
in.close();
try {
@@ -151,6 +157,7 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public boolean markSupported() {
return false;
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/CipherOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/CipherOutputStream.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/CipherOutputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/CipherOutputStream.java Thu Oct 26 20:44:22 2006
@@ -33,7 +33,7 @@
public class CipherOutputStream extends FilterOutputStream {
private final Cipher cipher;
- private byte[] arr = new byte[1];
+ private final byte[] arr = new byte[1];
/**
* @com.intel.drl.spec_ref
@@ -53,6 +53,7 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public void write(int b) throws IOException {
byte[] result;
arr[0] = (byte) b;
@@ -65,6 +66,7 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public void write(byte[] b) throws IOException {
write(b, 0, b.length);
}
@@ -72,6 +74,7 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public void write(byte[] b, int off, int len) throws IOException {
if (len == 0) {
return;
@@ -85,6 +88,7 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public void flush() throws IOException {
out.flush();
}
@@ -92,6 +96,7 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public void close() throws IOException {
byte[] result;
try {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/EncryptedPrivateKeyInfo.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/EncryptedPrivateKeyInfo.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/EncryptedPrivateKeyInfo.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/EncryptedPrivateKeyInfo.java Thu Oct 26 20:44:22 2006
@@ -359,14 +359,12 @@
if (stdName == null) {
// no above mappings available
return false;
- } else {
- this.oid = AlgNameMapper.map2OID(stdName);
- if (this.oid == null) {
- return false;
- } else {
- this.algName = stdName;
- }
}
+ this.oid = AlgNameMapper.map2OID(stdName);
+ if (this.oid == null) {
+ return false;
+ }
+ this.algName = stdName;
} else if (stdName != null) {
this.algName = stdName;
}
@@ -390,6 +388,7 @@
private static final ASN1Sequence asn1 = new ASN1Sequence(new ASN1Type[] {
AlgorithmIdentifier.ASN1, ASN1OctetString.getInstance() }) {
+ @Override
protected void getValues(Object object, Object[] values) {
EncryptedPrivateKeyInfo epki = (EncryptedPrivateKeyInfo) object;
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/ExemptionMechanism.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/ExemptionMechanism.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/ExemptionMechanism.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/ExemptionMechanism.java Thu Oct 26 20:44:22 2006
@@ -33,14 +33,8 @@
public class ExemptionMechanism {
- // Store spi implementation service name
- private static final String SERVICE = "ExemptionMechanism"; //$NON-NLS-1$
-
// Used to access common engine functionality
- private static Engine engine = new Engine(SERVICE);
-
- // Warning for reporting about not initializes ExemptionMechanism
- private static final String NOTINITEMECH = Messages.getString("crypto.2D"); //$NON-NLS-1$
+ private static final Engine engine = new Engine("ExemptionMechanism");
// Store used provider
private final Provider provider;
@@ -132,7 +126,7 @@
public final int getOutputSize(int inputLen) throws IllegalStateException {
if (!isInit) {
- throw new IllegalStateException(NOTINITEMECH);
+ throw new IllegalStateException(Messages.getString("crypto.2D"));
}
return spiImpl.engineGetOutputSize(inputLen);
}
@@ -166,7 +160,7 @@
public final byte[] genExemptionBlob() throws IllegalStateException,
ExemptionMechanismException {
if (!isInit) {
- throw new IllegalStateException(NOTINITEMECH);
+ throw new IllegalStateException(Messages.getString("crypto.2D"));
}
generated = false;
byte[] result = spiImpl.engineGenExemptionBlob();
@@ -184,7 +178,7 @@
throws IllegalStateException, ShortBufferException,
ExemptionMechanismException {
if (!isInit) {
- throw new IllegalStateException(NOTINITEMECH);
+ throw new IllegalStateException(Messages.getString("crypto.2D"));
}
generated = false;
int len = spiImpl.engineGenExemptionBlob(output, outputOffset);
@@ -192,6 +186,7 @@
return len;
}
+ @Override
protected void finalize() {
initKey = null;
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/KeyAgreement.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/KeyAgreement.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/KeyAgreement.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/KeyAgreement.java Thu Oct 26 20:44:22 2006
@@ -43,14 +43,11 @@
public class KeyAgreement {
- // Store spi implementation service name
- private static final String SERVICE = "KeyAgreement"; //$NON-NLS-1$
-
// Used to access common engine functionality
- private static Engine engine = new Engine(SERVICE);
+ private static final Engine engine = new Engine("KeyAgreement"); //$NON-NLS-1$
// Store SecureRandom
- private static SecureRandom rndm = new SecureRandom();
+ private static final SecureRandom rndm = new SecureRandom();
// Store used provider
private final Provider provider;
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/KeyGenerator.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/KeyGenerator.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/KeyGenerator.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/KeyGenerator.java Thu Oct 26 20:44:22 2006
@@ -41,14 +41,11 @@
public class KeyGenerator {
- // Store spi implementation service name
- private static final String SERVICE = "KeyGenerator"; //$NON-NLS-1$
-
// Used to access common engine functionality
- private static Engine engine = new Engine(SERVICE);
+ private static final Engine engine = new Engine("KeyGenerator"); //$NON-NLS-1$
// Store SecureRandom
- private static SecureRandom rndm = new SecureRandom();
+ private static final SecureRandom rndm = new SecureRandom();
// Store used provider
private final Provider provider;
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/Mac.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/Mac.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/Mac.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/Mac.java Thu Oct 26 20:44:22 2006
@@ -43,14 +43,8 @@
public class Mac implements Cloneable {
- // Store spi implementation service name
- private static final String SERVICE = "Mac"; //$NON-NLS-1$
-
//Used to access common engine functionality
- private static Engine engine = new Engine(SERVICE);
-
- // Warning for reporting about not initialized Mac
- private static final String NOTINITMAC = Messages.getString("crypto.01"); //$NON-NLS-1$
+ private static final Engine engine = new Engine("Mac"); //$NON-NLS-1$
// Store used provider
private final Provider provider;
@@ -189,7 +183,7 @@
*/
public final void update(byte input) throws IllegalStateException {
if (!isInitMac) {
- throw new IllegalStateException(NOTINITMAC);
+ throw new IllegalStateException(Messages.getString("crypto.01"));
}
spiImpl.engineUpdate(input);
}
@@ -201,7 +195,7 @@
public final void update(byte[] input, int offset, int len)
throws IllegalStateException {
if (!isInitMac) {
- throw new IllegalStateException(NOTINITMAC);
+ throw new IllegalStateException(Messages.getString("crypto.01"));
}
if (input == null) {
return;
@@ -218,7 +212,7 @@
*/
public final void update(byte[] input) throws IllegalStateException {
if (!isInitMac) {
- throw new IllegalStateException(NOTINITMAC);
+ throw new IllegalStateException(Messages.getString("crypto.01"));
}
if (input != null) {
spiImpl.engineUpdate(input, 0, input.length);
@@ -231,7 +225,7 @@
*/
public final void update(ByteBuffer input) {
if (!isInitMac) {
- throw new IllegalStateException(NOTINITMAC);
+ throw new IllegalStateException(Messages.getString("crypto.01"));
}
if (input != null) {
spiImpl.engineUpdate(input);
@@ -246,7 +240,7 @@
*/
public final byte[] doFinal() throws IllegalStateException {
if (!isInitMac) {
- throw new IllegalStateException(NOTINITMAC);
+ throw new IllegalStateException(Messages.getString("crypto.01"));
}
return spiImpl.engineDoFinal();
}
@@ -258,7 +252,7 @@
public final void doFinal(byte[] output, int outOffset)
throws ShortBufferException, IllegalStateException {
if (!isInitMac) {
- throw new IllegalStateException(NOTINITMAC);
+ throw new IllegalStateException(Messages.getString("crypto.01"));
}
if (output == null) {
throw new ShortBufferException(Messages.getString("crypto.08")); //$NON-NLS-1$
@@ -304,6 +298,7 @@
* @com.intel.drl.spec_ref
*
*/
+ @Override
public final Object clone() throws CloneNotSupportedException {
MacSpi newSpiImpl = (MacSpi)spiImpl.clone();
Mac mac = new Mac(newSpiImpl, this.provider, this.algorithm);
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/MacSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/MacSpi.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/MacSpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/MacSpi.java Thu Oct 26 20:44:22 2006
@@ -105,6 +105,7 @@
* @com.intel.drl.spec_ref
*
*/
+ @Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/SecretKeyFactory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/SecretKeyFactory.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/SecretKeyFactory.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/SecretKeyFactory.java Thu Oct 26 20:44:22 2006
@@ -40,11 +40,8 @@
*/
public class SecretKeyFactory {
- // Store spi implementation service name
- private static final String SERVICE = "SecretKeyFactory"; //$NON-NLS-1$
-
// Used to access common engine functionality
- private static Engine engine = new Engine(SERVICE);
+ private static final Engine engine = new Engine("SecretKeyFactory"); //$NON-NLS-1$
// Store used provider
private final Provider provider;
@@ -147,6 +144,7 @@
* @com.intel.drl.spec_ref
*
*/
+ @SuppressWarnings("unchecked")
public final KeySpec getKeySpec(SecretKey key, Class keySpec)
throws InvalidKeySpecException {
return spiImpl.engineGetKeySpec(key, keySpec);
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/SecretKeyFactorySpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/SecretKeyFactorySpi.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/SecretKeyFactorySpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/SecretKeyFactorySpi.java Thu Oct 26 20:44:22 2006
@@ -50,6 +50,7 @@
* @com.intel.drl.spec_ref
*
*/
+ @SuppressWarnings("unchecked")
protected abstract KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
throws InvalidKeySpecException;
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/RC2ParameterSpec.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/RC2ParameterSpec.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/RC2ParameterSpec.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/RC2ParameterSpec.java Thu Oct 26 20:44:22 2006
@@ -95,6 +95,7 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -110,13 +111,14 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public int hashCode() {
int result = effectiveKeyBits;
if (iv == null) {
return result;
}
- for (int i=0; i<iv.length; i++) {
- result += iv[i];
+ for (byte element : iv) {
+ result += element;
}
return result;
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/RC5ParameterSpec.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/RC5ParameterSpec.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/RC5ParameterSpec.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/RC5ParameterSpec.java Thu Oct 26 20:44:22 2006
@@ -123,6 +123,7 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -140,13 +141,14 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public int hashCode() {
int result = version + rounds + wordSize;
if (iv == null) {
return result;
}
- for (int i=0; i<iv.length; i++) {
- result += iv[i] & 0xFF;
+ for (byte element : iv) {
+ result += element & 0xFF;
}
return result;
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/SecretKeySpec.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/SecretKeySpec.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/SecretKeySpec.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/SecretKeySpec.java Thu Oct 26 20:44:22 2006
@@ -112,10 +112,11 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public int hashCode() {
int result = algorithm.length();
- for (int i=0; i<key.length; i++) {
- result += key[i];
+ for (byte element : key) {
+ result += element;
}
return result;
}
@@ -123,6 +124,7 @@
/**
* @com.intel.drl.spec_ref
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/org/apache/harmony/crypto/internal/NullCipherSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/org/apache/harmony/crypto/internal/NullCipherSpi.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/org/apache/harmony/crypto/internal/NullCipherSpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/org/apache/harmony/crypto/internal/NullCipherSpi.java Thu Oct 26 20:44:22 2006
@@ -45,80 +45,57 @@
*/
public class NullCipherSpi extends CipherSpi {
- /**
- * See javax.crypto.CipherSpi#engineSetMode(java.lang.String)
- */
+ @Override
public void engineSetMode(String arg0) throws NoSuchAlgorithmException {
// Do nothing
}
- /**
- * See javax.crypto.CipherSpi#engineSetPadding(java.lang.String)
- */
+ @Override
public void engineSetPadding(String arg0) throws NoSuchPaddingException {
// Do nothing
}
- /**
- * See javax.crypto.CipherSpi#engineGetBlockSize()
- */
+ @Override
public int engineGetBlockSize() {
return 1;
}
- /**
- * See javax.crypto.CipherSpi#engineGetOutputSize(int)
- */
+ @Override
public int engineGetOutputSize(int inputLen) {
return inputLen;
}
- /**
- * See javax.crypto.CipherSpi#engineGetIV()
- */
+ @Override
public byte[] engineGetIV() {
return new byte[8]; // compatible with RI
}
- /**
- * See javax.crypto.CipherSpi#engineGetParameters()
- */
+ @Override
public AlgorithmParameters engineGetParameters() {
return null;
}
- /**
- * See javax.crypto.CipherSpi#engineInit(int, java.security.Key,
- * java.security.SecureRandom)
- */
+ @Override
public void engineInit(int opmode, Key key, SecureRandom random)
throws InvalidKeyException {
// Do nothing
}
- /**
- * See javax.crypto.CipherSpi#engineInit(int, java.security.Key,
- * java.security.spec.AlgorithmParameterSpec, java.security.SecureRandom)
- */
+ @Override
public void engineInit(int opmode, Key key, AlgorithmParameterSpec params,
SecureRandom random) throws InvalidKeyException,
InvalidAlgorithmParameterException {
// Do nothing
}
- /**
- * See javax.crypto.CipherSpi#engineInit(int, java.security.Key,
- * java.security.AlgorithmParameters, java.security.SecureRandom)
- */
+ @Override
public void engineInit(int opmode, Key key, AlgorithmParameters params,
SecureRandom random) throws InvalidKeyException,
InvalidAlgorithmParameterException {
// Do nothing
}
- /**
- * See javax.crypto.CipherSpi#engineUpdate(byte[], int, int)
- */
+ @Override
public byte[] engineUpdate(byte[] input, int inputOffset, int inputLen) {
if (input == null) {
return null;
@@ -128,9 +105,7 @@
return result;
}
- /**
- * See javax.crypto.CipherSpi#engineUpdate(byte[], int, int, byte[], int)
- */
+ @Override
public int engineUpdate(byte[] input, int inputOffset, int inputLen,
byte[] output, int outputOffset) throws ShortBufferException {
if (input == null) {
@@ -140,9 +115,7 @@
return inputLen;
}
- /**
- * See javax.crypto.CipherSpi#engineUpdate(ByteBuffer, ByteBuffer)
- */
+ @Override
public int engineUpdate(ByteBuffer input, ByteBuffer output)
throws ShortBufferException {
if (input == null || output == null) {
@@ -157,9 +130,7 @@
return result;
}
- /**
- * See javax.crypto.CipherSpi#engineDoFinal(byte[], int, int)
- */
+ @Override
public byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen)
throws IllegalBlockSizeException, BadPaddingException {
if (input == null) {
@@ -168,9 +139,7 @@
return engineUpdate(input, inputOffset, inputLen);
}
- /**
- * See javax.crypto.CipherSpi#engineDoFinal(byte[], int, int, byte[], int)
- */
+ @Override
public int engineDoFinal(byte[] input, int inputOffset, int inputLen,
byte[] output, int outputOffset) throws ShortBufferException,
IllegalBlockSizeException, BadPaddingException {
@@ -179,35 +148,27 @@
return result;
}
- /**
- * See javax.crypto.CipherSpi#engineDoFinal(ByteBuffer, ByteBuffer)
- */
+ @Override
public int engineDoFinal(ByteBuffer input, ByteBuffer output)
throws ShortBufferException, IllegalBlockSizeException,
BadPaddingException {
return engineUpdate(input, output);
}
- /**
- * See javax.crypto.CipherSpi#engineWrap(Key)
- */
+ @Override
public byte[] engineWrap(Key key) throws IllegalBlockSizeException,
InvalidKeyException {
throw new UnsupportedOperationException(Messages.getString("crypto.44")); //$NON-NLS-1$
}
- /**
- * See javax.crypto.CipherSpi#engineUnwrap(byte[], String, int)
- */
+ @Override
public Key engineUnwrap(byte[] wrappedKey, String wrappedKeyAlgorithm,
int wrappedKeyType) throws InvalidKeyException,
NoSuchAlgorithmException {
throw new UnsupportedOperationException(Messages.getString("crypto.45")); //$NON-NLS-1$
}
- /**
- * See javax.crypto.CipherSpi#engineGetKeySize(Key)
- */
+ @Override
public int engineGetKeySize(Key key) throws InvalidKeyException {
throw new UnsupportedOperationException(Messages.getString("crypto.46")); //$NON-NLS-1$
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/org/apache/harmony/crypto/utils/AlgNameMapper.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/org/apache/harmony/crypto/utils/AlgNameMapper.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/org/apache/harmony/crypto/utils/AlgNameMapper.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/org/apache/harmony/crypto/utils/AlgNameMapper.java Thu Oct 26 20:44:22 2006
@@ -25,9 +25,9 @@
import java.security.Provider;
import java.security.Security;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import java.util.Map.Entry;
import org.apache.harmony.security.asn1.ObjectIdentifier;
@@ -103,20 +103,19 @@
{"2.23.42.9.11.4.1", "ECDSA"}, //$NON-NLS-1$ //$NON-NLS-2$
};
// Maps alg name to OID
- private static final HashMap alg2OidMap = new HashMap();
+ private static final Map<String, String> alg2OidMap = new HashMap<String, String>();
// Maps OID to alg name
- private static final HashMap oid2AlgMap = new HashMap();
+ private static final Map<String, String> oid2AlgMap = new HashMap<String, String>();
// Maps aliases to alg names
- private static final HashMap algAliasesMap = new HashMap();
+ private static final Map<String, String> algAliasesMap = new HashMap<String, String>();
static {
- // put known mappings before
- for (int i = 0; i<knownAlgMappings.length; i++) {
- String algUC = knownAlgMappings[i][1].toUpperCase();
- alg2OidMap.put(algUC, knownAlgMappings[i][0]);
- oid2AlgMap.put(knownAlgMappings[i][0], algUC);
+ for (String[] element : knownAlgMappings) {
+ String algUC = element[1].toUpperCase();
+ alg2OidMap.put(algUC, element[0]);
+ oid2AlgMap.put(element[0], algUC);
// map upper case alg name to its original name
- algAliasesMap.put(algUC, knownAlgMappings[i][1]);
+ algAliasesMap.put(algUC, element[1]);
}
//
// Now search providers for mappings like
@@ -125,8 +124,8 @@
// Alg.Alias.<service>.OID.<OID-INTS-DOT-SEPARATED>=<alg-name>
//
Provider[] pl = Security.getProviders();
- for (int i = 0; i<pl.length; i++) {
- selectEntries(pl[i]);
+ for (Provider element : pl) {
+ selectEntries(element);
}
}
@@ -142,7 +141,7 @@
*/
public static String map2OID(String algName) {
// alg2OidMap map contains upper case keys
- return (String)alg2OidMap.get(algName.toUpperCase());
+ return alg2OidMap.get(algName.toUpperCase());
}
/**
@@ -153,9 +152,9 @@
*/
public static String map2AlgName(String oid) {
// oid2AlgMap map contains upper case values
- String algUC = (String)oid2AlgMap.get(oid);
+ String algUC = oid2AlgMap.get(oid);
// if not null there is always map UC->Orig
- return algUC == null ? null : (String)algAliasesMap.get(algUC);
+ return algUC == null ? null : algAliasesMap.get(algUC);
}
/**
@@ -165,7 +164,7 @@
* @return algorithm name
*/
public static String getStandardName(String algName) {
- return (String)algAliasesMap.get(algName.toUpperCase());
+ return algAliasesMap.get(algName.toUpperCase());
}
// Searches given provider for mappings like
@@ -174,11 +173,10 @@
// Alg.Alias.<service>.OID.<OID-INTS-DOT-SEPARATED>=<alg-name>
// Puts mappings found into appropriate internal maps
private static void selectEntries(Provider p) {
- Set entrySet = p.entrySet();
- for (int i=0; i<serviceName.length; i++) {
- String keyPrfix2find = "Alg.Alias." + serviceName[i] + "."; //$NON-NLS-1$ //$NON-NLS-2$
- for (Iterator it = entrySet.iterator(); it.hasNext();) {
- Map.Entry me = (Map.Entry)it.next();
+ Set<Map.Entry<Object, Object>> entrySet = p.entrySet();
+ for (String service : serviceName) {
+ String keyPrfix2find = "Alg.Alias." + service + "."; //$NON-NLS-1$ //$NON-NLS-2$
+ for (Entry<Object, Object> me : entrySet) {
String key = (String)me.getKey();
if (key.startsWith(keyPrfix2find)) {
String alias = key.substring(keyPrfix2find.length());
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/EncryptedPrivateKeyInfoData.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/EncryptedPrivateKeyInfoData.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/EncryptedPrivateKeyInfoData.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/EncryptedPrivateKeyInfoData.java Thu Oct 26 20:44:22 2006
@@ -1006,7 +1006,7 @@
/**
* Valid DSA parameters encoding
*/
- private static byte[] dsaParamsEncoded = { (byte) 0x30, (byte) 0x82,
+ private static final byte[] dsaParamsEncoded = { (byte) 0x30, (byte) 0x82,
(byte) 0x01, (byte) 0x1e, (byte) 0x02, (byte) 0x81, (byte) 0x81,
(byte) 0x00, (byte) 0x9f, (byte) 0x5e, (byte) 0x76, (byte) 0x19,
(byte) 0x59, (byte) 0xd8, (byte) 0xf7, (byte) 0x6b, (byte) 0x91,
@@ -1069,7 +1069,7 @@
/**
* Valid DH parameters encoding
*/
- private static byte[] dhParamsEncoded = { (byte) 0x30, (byte) 0x82,
+ private static final byte[] dhParamsEncoded = { (byte) 0x30, (byte) 0x82,
(byte) 0x01, (byte) 0x0b, (byte) 0x02, (byte) 0x81, (byte) 0x81,
(byte) 0x00, (byte) 0xce, (byte) 0x2c, (byte) 0x4f, (byte) 0xea,
(byte) 0xf2, (byte) 0x83, (byte) 0xc5, (byte) 0x38, (byte) 0xc9,
@@ -1130,11 +1130,11 @@
*/
public static final byte[] encryptedData;
- private static final HashMap validEPKIEncodings = new HashMap();
+ private static final HashMap<String, byte[]> validEPKIEncodings = new HashMap<String, byte[]>();
- private static final HashMap validEPKIEncodingsNP = new HashMap();
+ private static final HashMap<String, byte[]> validEPKIEncodingsNP = new HashMap<String, byte[]>();
- private static final HashMap validAPEncodings = new HashMap();
+ private static final HashMap<String, byte[]> validAPEncodings = new HashMap<String, byte[]>();
static {
validEPKIEncodings.put("DH", dhEncryptedPrivateKeyInfo);
@@ -1195,8 +1195,8 @@
String algName, boolean includingAlgParameters)
throws NoSuchAlgorithmException {
String algNameUC = algName.toUpperCase();
- byte[] ret = includingAlgParameters ? (byte[]) validEPKIEncodings
- .get(algNameUC) : (byte[]) validEPKIEncodingsNP.get(algNameUC);
+ byte[] ret = includingAlgParameters ? validEPKIEncodings
+ .get(algNameUC) : validEPKIEncodingsNP.get(algNameUC);
if (ret != null) {
return ret.clone();
}
@@ -1218,7 +1218,7 @@
public static byte[] getParametersEncoding(String algName)
throws NoSuchAlgorithmException {
String algNameUC = algName.toUpperCase();
- byte[] ret = (byte[]) validAPEncodings.get(algNameUC);
+ byte[] ret = validAPEncodings.get(algNameUC);
if (ret != null) {
return ret;
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyCipher.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyCipher.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyCipher.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyCipher.java Thu Oct 26 20:44:22 2006
@@ -45,62 +45,75 @@
super();
}
- protected void engineSetMode(String mode) throws NoSuchAlgorithmException {
+ @Override
+ protected void engineSetMode(String mode) throws NoSuchAlgorithmException {
}
- protected void engineSetPadding(String padding)
+ @Override
+ protected void engineSetPadding(String padding)
throws NoSuchPaddingException {
if (!"PKCS5Padding".equals(padding)) {
throw new NoSuchPaddingException(padding);
}
}
- protected int engineGetBlockSize() {
+ @Override
+ protected int engineGetBlockSize() {
return 111;
}
- protected int engineGetOutputSize(int inputLen) {
+ @Override
+ protected int engineGetOutputSize(int inputLen) {
return inputLen + 10;
}
- protected byte[] engineGetIV() {
+ @Override
+ protected byte[] engineGetIV() {
byte[] b = {1,2,3};
return b;
}
- protected AlgorithmParameters engineGetParameters() {
+ @Override
+ protected AlgorithmParameters engineGetParameters() {
return null;
}
- protected void engineInit(int opmode, Key key, SecureRandom random)
+ @Override
+ protected void engineInit(int opmode, Key key, SecureRandom random)
throws InvalidKeyException {
}
- protected void engineInit(int opmode, Key key,
+ @Override
+ protected void engineInit(int opmode, Key key,
AlgorithmParameterSpec params, SecureRandom random)
throws InvalidKeyException, InvalidAlgorithmParameterException {
}
- protected void engineInit(int opmode, Key key, AlgorithmParameters params,
+ @Override
+ protected void engineInit(int opmode, Key key, AlgorithmParameters params,
SecureRandom random) throws InvalidKeyException,
InvalidAlgorithmParameterException {
}
- protected byte[] engineUpdate(byte[] input, int inputOffset, int inputLen) {
+ @Override
+ protected byte[] engineUpdate(byte[] input, int inputOffset, int inputLen) {
return null;
}
- protected int engineUpdate(byte[] input, int inputOffset, int inputLen,
+ @Override
+ protected int engineUpdate(byte[] input, int inputOffset, int inputLen,
byte[] output, int outputOffset) throws ShortBufferException {
return 0;
}
- protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen)
+ @Override
+ protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen)
throws IllegalBlockSizeException, BadPaddingException {
return null;
}
- protected int engineDoFinal(byte[] input, int inputOffset, int inputLen,
+ @Override
+ protected int engineDoFinal(byte[] input, int inputOffset, int inputLen,
byte[] output, int outputOffset) throws ShortBufferException,
IllegalBlockSizeException, BadPaddingException {
return 0;
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyExemptionMechanismSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyExemptionMechanismSpi.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyExemptionMechanismSpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyExemptionMechanismSpi.java Thu Oct 26 20:44:22 2006
@@ -45,20 +45,24 @@
public static final int getLength() {
return byteArrayLength;
}
+ @Override
protected byte[] engineGenExemptionBlob()
throws ExemptionMechanismException {
return new byte[byteArrayLength];
}
+ @Override
protected int engineGenExemptionBlob(byte[] output, int outputOffset)
throws ShortBufferException, ExemptionMechanismException {
return byteArrayLength;
}
+ @Override
protected int engineGetOutputSize(int inputLen) {
return 10;
}
+ @Override
protected void engineInit(Key key) throws InvalidKeyException,
ExemptionMechanismException {
if (key == null) {
@@ -69,6 +73,7 @@
}
}
+ @Override
protected void engineInit(Key key, AlgorithmParameters params)
throws InvalidKeyException, InvalidAlgorithmParameterException,
ExemptionMechanismException {
@@ -80,6 +85,7 @@
}
}
+ @Override
protected void engineInit(Key key, AlgorithmParameterSpec params)
throws InvalidKeyException, InvalidAlgorithmParameterException,
ExemptionMechanismException {
@@ -91,6 +97,7 @@
}
}
+ @SuppressWarnings("serial")
public class tmpKey implements Key {
private String alg;
private byte[] enc;
@@ -108,6 +115,7 @@
return enc;
}
}
+ @SuppressWarnings("serial")
public class tmp1Key implements Key {
private byte[] enc;
public tmp1Key(String alg, byte[] enc) {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyKeyAgreementSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyKeyAgreementSpi.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyKeyAgreementSpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyKeyAgreementSpi.java Thu Oct 26 20:44:22 2006
@@ -41,6 +41,7 @@
public class MyKeyAgreementSpi extends KeyAgreementSpi {
+ @Override
protected Key engineDoPhase(Key key, boolean lastPhase)
throws InvalidKeyException, IllegalStateException {
if (!lastPhase) {
@@ -49,15 +50,18 @@
return null;
}
+ @Override
protected byte[] engineGenerateSecret() throws IllegalStateException {
return new byte[0];
}
+ @Override
protected int engineGenerateSecret(byte[] sharedSecret, int offset)
throws IllegalStateException, ShortBufferException {
return -1;
}
+ @Override
protected SecretKey engineGenerateSecret(String algorithm)
throws IllegalStateException, NoSuchAlgorithmException,
InvalidKeyException {
@@ -67,11 +71,13 @@
return null;
}
+ @Override
protected void engineInit(Key key, SecureRandom random)
throws InvalidKeyException {
throw new IllegalArgumentException("Invalid parameter");
}
+ @Override
protected void engineInit(Key key, AlgorithmParameterSpec params,
SecureRandom random) throws InvalidKeyException,
InvalidAlgorithmParameterException {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyKeyGeneratorSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyKeyGeneratorSpi.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyKeyGeneratorSpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyKeyGeneratorSpi.java Thu Oct 26 20:44:22 2006
@@ -37,10 +37,12 @@
public class MyKeyGeneratorSpi extends KeyGeneratorSpi {
+ @Override
protected SecretKey engineGenerateKey() {
return null;
}
+ @Override
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random)
throws InvalidAlgorithmParameterException {
if (params == null) {
@@ -48,12 +50,14 @@
}
}
+ @Override
protected void engineInit(int keysize, SecureRandom random) {
if (keysize <= 77) {
throw new IllegalArgumentException("Invalid keysize");
}
}
+ @Override
protected void engineInit(SecureRandom random) {
throw new IllegalArgumentException("Invalid random");
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyMacSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyMacSpi.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyMacSpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyMacSpi.java Thu Oct 26 20:44:22 2006
@@ -38,10 +38,12 @@
public class MyMacSpi extends MacSpi {
private int length = 0;
+ @Override
protected int engineGetMacLength() {
return length;
}
+ @Override
protected void engineInit(Key key, AlgorithmParameterSpec params)
throws InvalidKeyException, InvalidAlgorithmParameterException {
if (params == null) {
@@ -51,19 +53,23 @@
}
}
+ @Override
protected void engineUpdate(byte input) {
}
+ @Override
protected void engineUpdate(byte[] input, int offset, int len) {
if (offset >= 0 && len >= 0) {
length = len;
}
}
+ @Override
protected byte[] engineDoFinal() {
return new byte[length];
}
+ @Override
protected void engineReset() {
length++;
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MySecretKeyFactorySpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MySecretKeyFactorySpi.java?view=diff&rev=468250&r1=468249&r2=468250
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MySecretKeyFactorySpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MySecretKeyFactorySpi.java Thu Oct 26 20:44:22 2006
@@ -36,16 +36,20 @@
*/
public class MySecretKeyFactorySpi extends SecretKeyFactorySpi {
+ @Override
protected SecretKey engineGenerateSecret(KeySpec keySpec)
throws InvalidKeySpecException {
return null;
}
+ @SuppressWarnings("unchecked")
+ @Override
protected KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
throws InvalidKeySpecException {
return null;
}
+ @Override
protected SecretKey engineTranslateKey(SecretKey key)
throws InvalidKeyException {
return null;