You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/04/07 12:17:27 UTC
svn commit: r392237 [2/4] - in
/incubator/harmony/enhanced/classlib/trunk/modules:
beans/src/test/java/org/apache/harmony/tests/java/beans/
crypto/src/main/java/javax/crypto/ crypto/src/test/java/javax/crypto/
regex-beans-math/doc/ security/src/test/ja...
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/KeyAgreement.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/KeyAgreement.java?rev=392237&r1=392236&r2=392237&view=diff
==============================================================================
--- 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 Fri Apr 7 03:17:21 2006
@@ -1,213 +1,213 @@
-/*
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
-* @author Vera Y. Petrashkova
-* @version $Revision$
-*/
-
-package javax.crypto;
-
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.security.Key;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Provider;
-import java.security.SecureRandom;
-import java.security.Security;
-import java.security.spec.AlgorithmParameterSpec;
-
-import org.apache.harmony.security.fortress.Engine;
-
-
-/**
- * @com.intel.drl.spec_ref
- *
- */
-
-public class KeyAgreement {
-
- // Store spi implementation service name
- private static final String SERVICE = "KeyAgreement";
-
- // Used to accesess common engine functionality
- private static Engine engine = new Engine(SERVICE);
-
- // Store SecureRandom
- private static SecureRandom rndm = new SecureRandom();
-
- // Store used provider
- private final Provider provider;
-
- // Store used spi implementation
- private final KeyAgreementSpi spiImpl;
-
- // Store used algorithm name
- private final String algorithm;
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- protected KeyAgreement(KeyAgreementSpi keyAgreeSpi, Provider provider,
- String algorithm) {
- this.provider = provider;
- this.algorithm = algorithm;
- this.spiImpl = keyAgreeSpi;
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final String getAlgorithm() {
- return algorithm;
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final Provider getProvider() {
- return provider;
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public static final KeyAgreement getInstance(String algorithm)
- throws NoSuchAlgorithmException {
- if (algorithm == null) {
- throw new NullPointerException("Algorithm is null");
- }
- synchronized (engine) {
- engine.getInstance(algorithm, null);
- return new KeyAgreement((KeyAgreementSpi) engine.spi, engine.provider,
- algorithm);
- }
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public static final KeyAgreement getInstance(String algorithm,
- String provider) throws NoSuchAlgorithmException,
- NoSuchProviderException {
- if ((provider == null) || (provider.length() == 0)) {
- throw new IllegalArgumentException("Provider is null or empty");
- }
- Provider impProvider = Security.getProvider(provider);
- if (impProvider == null) {
- throw new NoSuchProviderException(provider);
- }
- return getInstance(algorithm, impProvider);
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public static final KeyAgreement getInstance(String algorithm,
- Provider provider) throws NoSuchAlgorithmException {
- if (provider == null) {
- throw new IllegalArgumentException("Provider is null");
- }
- if (algorithm == null) {
- throw new NullPointerException("Algorithm is null");
- }
- synchronized (engine) {
- engine.getInstance(algorithm, provider, null);
- return new KeyAgreement((KeyAgreementSpi) engine.spi, provider,
- algorithm);
- }
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final void init(Key key) throws InvalidKeyException {
- spiImpl.engineInit(key, rndm);//new SecureRandom());
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final void init(Key key, SecureRandom random)
- throws InvalidKeyException {
- spiImpl.engineInit(key, random);
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final void init(Key key, AlgorithmParameterSpec params)
- throws InvalidKeyException, InvalidAlgorithmParameterException {
- spiImpl.engineInit(key, params, rndm);//new SecureRandom());
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final void init(Key key, AlgorithmParameterSpec params,
- SecureRandom random) throws InvalidKeyException,
- InvalidAlgorithmParameterException {
- spiImpl.engineInit(key, params, random);
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final Key doPhase(Key key, boolean lastPhase)
- throws InvalidKeyException, IllegalStateException {
- return spiImpl.engineDoPhase(key, lastPhase);
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final byte[] generateSecret() throws IllegalStateException {
- return spiImpl.engineGenerateSecret();
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final int generateSecret(byte[] sharedSecret, int offset)
- throws IllegalStateException, ShortBufferException {
- return spiImpl.engineGenerateSecret(sharedSecret, offset);
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final SecretKey generateSecret(String algorithm)
- throws IllegalStateException, NoSuchAlgorithmException,
- InvalidKeyException {
- return spiImpl.engineGenerateSecret(algorithm);
- }
-
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+* @author Vera Y. Petrashkova
+* @version $Revision$
+*/
+
+package javax.crypto;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.SecureRandom;
+import java.security.Security;
+import java.security.spec.AlgorithmParameterSpec;
+
+import org.apache.harmony.security.fortress.Engine;
+
+
+/**
+ * @com.intel.drl.spec_ref
+ *
+ */
+
+public class KeyAgreement {
+
+ // Store spi implementation service name
+ private static final String SERVICE = "KeyAgreement";
+
+ // Used to access common engine functionality
+ private static Engine engine = new Engine(SERVICE);
+
+ // Store SecureRandom
+ private static SecureRandom rndm = new SecureRandom();
+
+ // Store used provider
+ private final Provider provider;
+
+ // Store used spi implementation
+ private final KeyAgreementSpi spiImpl;
+
+ // Store used algorithm name
+ private final String algorithm;
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ protected KeyAgreement(KeyAgreementSpi keyAgreeSpi, Provider provider,
+ String algorithm) {
+ this.provider = provider;
+ this.algorithm = algorithm;
+ this.spiImpl = keyAgreeSpi;
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final String getAlgorithm() {
+ return algorithm;
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final Provider getProvider() {
+ return provider;
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public static final KeyAgreement getInstance(String algorithm)
+ throws NoSuchAlgorithmException {
+ if (algorithm == null) {
+ throw new NullPointerException("Algorithm is null");
+ }
+ synchronized (engine) {
+ engine.getInstance(algorithm, null);
+ return new KeyAgreement((KeyAgreementSpi) engine.spi, engine.provider,
+ algorithm);
+ }
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public static final KeyAgreement getInstance(String algorithm,
+ String provider) throws NoSuchAlgorithmException,
+ NoSuchProviderException {
+ if ((provider == null) || (provider.length() == 0)) {
+ throw new IllegalArgumentException("Provider is null or empty");
+ }
+ Provider impProvider = Security.getProvider(provider);
+ if (impProvider == null) {
+ throw new NoSuchProviderException(provider);
+ }
+ return getInstance(algorithm, impProvider);
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public static final KeyAgreement getInstance(String algorithm,
+ Provider provider) throws NoSuchAlgorithmException {
+ if (provider == null) {
+ throw new IllegalArgumentException("Provider is null");
+ }
+ if (algorithm == null) {
+ throw new NullPointerException("Algorithm is null");
+ }
+ synchronized (engine) {
+ engine.getInstance(algorithm, provider, null);
+ return new KeyAgreement((KeyAgreementSpi) engine.spi, provider,
+ algorithm);
+ }
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final void init(Key key) throws InvalidKeyException {
+ spiImpl.engineInit(key, rndm);//new SecureRandom());
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final void init(Key key, SecureRandom random)
+ throws InvalidKeyException {
+ spiImpl.engineInit(key, random);
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final void init(Key key, AlgorithmParameterSpec params)
+ throws InvalidKeyException, InvalidAlgorithmParameterException {
+ spiImpl.engineInit(key, params, rndm);//new SecureRandom());
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final void init(Key key, AlgorithmParameterSpec params,
+ SecureRandom random) throws InvalidKeyException,
+ InvalidAlgorithmParameterException {
+ spiImpl.engineInit(key, params, random);
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final Key doPhase(Key key, boolean lastPhase)
+ throws InvalidKeyException, IllegalStateException {
+ return spiImpl.engineDoPhase(key, lastPhase);
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final byte[] generateSecret() throws IllegalStateException {
+ return spiImpl.engineGenerateSecret();
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final int generateSecret(byte[] sharedSecret, int offset)
+ throws IllegalStateException, ShortBufferException {
+ return spiImpl.engineGenerateSecret(sharedSecret, offset);
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final SecretKey generateSecret(String algorithm)
+ throws IllegalStateException, NoSuchAlgorithmException,
+ InvalidKeyException {
+ return spiImpl.engineGenerateSecret(algorithm);
+ }
+
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/KeyGenerator.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/KeyGenerator.java?rev=392237&r1=392236&r2=392237&view=diff
==============================================================================
--- 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 Fri Apr 7 03:17:21 2006
@@ -1,188 +1,188 @@
-/*
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
-* @author Vera Y. Petrashkova
-* @version $Revision$
-*/
-
-package javax.crypto;
-
-import java.security.InvalidAlgorithmParameterException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Provider;
-import java.security.SecureRandom;
-import java.security.Security;
-import java.security.spec.AlgorithmParameterSpec;
-
-import org.apache.harmony.security.fortress.Engine;
-
-
-/**
- * @com.intel.drl.spec_ref
- *
- */
-
-public class KeyGenerator {
-
- // Store spi implementation service name
- private static final String SERVICE = "KeyGenerator";
-
- // Used to accesess common engine functionality
- private static Engine engine = new Engine(SERVICE);
-
- // Store SecureRandom
- private static SecureRandom rndm = new SecureRandom();
-
- // Store used provider
- private final Provider provider;
-
- // Store used spi implementation
- private final KeyGeneratorSpi spiImpl;
-
- // Store used algorithm name
- private final String algorithm;
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- protected KeyGenerator(KeyGeneratorSpi keyGenSpi, Provider provider,
- String algorithm) {
- this.provider = provider;
- this.algorithm = algorithm;
- this.spiImpl = keyGenSpi;
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final String getAlgorithm() {
- return algorithm;
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final Provider getProvider() {
- return provider;
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public static final KeyGenerator getInstance(String algorithm)
- throws NoSuchAlgorithmException {
- if (algorithm == null) {
- throw new NullPointerException("Algorithm is null");
- }
- synchronized (engine) {
- engine.getInstance(algorithm, null);
- return new KeyGenerator((KeyGeneratorSpi) engine.spi, engine.provider,
- algorithm);
- }
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public static final KeyGenerator getInstance(String algorithm,
- String provider) throws NoSuchAlgorithmException,
- NoSuchProviderException {
- if ((provider == null) || (provider.length() == 0)) {
- throw new IllegalArgumentException("Provider is null or empty");
- }
- Provider impProvider = Security.getProvider(provider);
- if (impProvider == null) {
- throw new NoSuchProviderException(provider);
- }
- return getInstance(algorithm, impProvider);
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public static final KeyGenerator getInstance(String algorithm,
- Provider provider) throws NoSuchAlgorithmException {
- if (provider == null) {
- throw new IllegalArgumentException("Provider is null");
- }
- if (algorithm == null) {
- throw new NullPointerException("Algorithm is null");
- }
- synchronized (engine) {
- engine.getInstance(algorithm, provider, null);
- return new KeyGenerator((KeyGeneratorSpi) engine.spi, provider,
- algorithm);
- }
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final SecretKey generateKey() {
- return spiImpl.engineGenerateKey();
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final void init(AlgorithmParameterSpec params)
- throws InvalidAlgorithmParameterException {
- spiImpl.engineInit(params, rndm);//new SecureRandom());
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final void init(AlgorithmParameterSpec params, SecureRandom random)
- throws InvalidAlgorithmParameterException {
- spiImpl.engineInit(params, random);
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final void init(int keysize) {
- spiImpl.engineInit(keysize, rndm);//new SecureRandom());
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final void init(int keysize, SecureRandom random) {
- spiImpl.engineInit(keysize, random);
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final void init(SecureRandom random) {
- spiImpl.engineInit(random);
- }
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+* @author Vera Y. Petrashkova
+* @version $Revision$
+*/
+
+package javax.crypto;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.SecureRandom;
+import java.security.Security;
+import java.security.spec.AlgorithmParameterSpec;
+
+import org.apache.harmony.security.fortress.Engine;
+
+
+/**
+ * @com.intel.drl.spec_ref
+ *
+ */
+
+public class KeyGenerator {
+
+ // Store spi implementation service name
+ private static final String SERVICE = "KeyGenerator";
+
+ // Used to access common engine functionality
+ private static Engine engine = new Engine(SERVICE);
+
+ // Store SecureRandom
+ private static SecureRandom rndm = new SecureRandom();
+
+ // Store used provider
+ private final Provider provider;
+
+ // Store used spi implementation
+ private final KeyGeneratorSpi spiImpl;
+
+ // Store used algorithm name
+ private final String algorithm;
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ protected KeyGenerator(KeyGeneratorSpi keyGenSpi, Provider provider,
+ String algorithm) {
+ this.provider = provider;
+ this.algorithm = algorithm;
+ this.spiImpl = keyGenSpi;
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final String getAlgorithm() {
+ return algorithm;
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final Provider getProvider() {
+ return provider;
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public static final KeyGenerator getInstance(String algorithm)
+ throws NoSuchAlgorithmException {
+ if (algorithm == null) {
+ throw new NullPointerException("Algorithm is null");
+ }
+ synchronized (engine) {
+ engine.getInstance(algorithm, null);
+ return new KeyGenerator((KeyGeneratorSpi) engine.spi, engine.provider,
+ algorithm);
+ }
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public static final KeyGenerator getInstance(String algorithm,
+ String provider) throws NoSuchAlgorithmException,
+ NoSuchProviderException {
+ if ((provider == null) || (provider.length() == 0)) {
+ throw new IllegalArgumentException("Provider is null or empty");
+ }
+ Provider impProvider = Security.getProvider(provider);
+ if (impProvider == null) {
+ throw new NoSuchProviderException(provider);
+ }
+ return getInstance(algorithm, impProvider);
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public static final KeyGenerator getInstance(String algorithm,
+ Provider provider) throws NoSuchAlgorithmException {
+ if (provider == null) {
+ throw new IllegalArgumentException("Provider is null");
+ }
+ if (algorithm == null) {
+ throw new NullPointerException("Algorithm is null");
+ }
+ synchronized (engine) {
+ engine.getInstance(algorithm, provider, null);
+ return new KeyGenerator((KeyGeneratorSpi) engine.spi, provider,
+ algorithm);
+ }
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final SecretKey generateKey() {
+ return spiImpl.engineGenerateKey();
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final void init(AlgorithmParameterSpec params)
+ throws InvalidAlgorithmParameterException {
+ spiImpl.engineInit(params, rndm);//new SecureRandom());
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final void init(AlgorithmParameterSpec params, SecureRandom random)
+ throws InvalidAlgorithmParameterException {
+ spiImpl.engineInit(params, random);
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final void init(int keysize) {
+ spiImpl.engineInit(keysize, rndm);//new SecureRandom());
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final void init(int keysize, SecureRandom random) {
+ spiImpl.engineInit(keysize, random);
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final void init(SecureRandom random) {
+ spiImpl.engineInit(random);
+ }
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/Mac.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/Mac.java?rev=392237&r1=392236&r2=392237&view=diff
==============================================================================
--- 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 Fri Apr 7 03:17:21 2006
@@ -1,311 +1,311 @@
-/*
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
-* @author Vera Y. Petrashkova
-* @version $Revision$
-*/
-
-package javax.crypto;
-
-import java.nio.ByteBuffer;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.security.Key;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Provider;
-import java.security.Security;
-import java.security.spec.AlgorithmParameterSpec;
-
-import org.apache.harmony.security.fortress.Engine;
-
-
-/**
- * @com.intel.drl.spec_ref
- *
- */
-
-public class Mac implements Cloneable {
-
- // Store spi implementation service name
- private static final String SERVICE = "Mac";
-
- //Used to accesess common engine functionality
- private static Engine engine = new Engine(SERVICE);
-
- // Warning for reporting about not initialized Mac
- private static final String NOTINITMAC = "MAC was not initialized";
-
- // Store used provider
- private final Provider provider;
-
- // Store used spi implementation
- private final MacSpi spiImpl;
-
- // Store used algorithm name
- private final String algorithm;
-
- // Store Mac state (initialized or not initialized)
- private boolean isInitMac;
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- protected Mac(MacSpi macSpi, Provider provider, String algorithm) {
- this.provider = provider;
- this.algorithm = algorithm;
- this.spiImpl = macSpi;
- this.isInitMac = false;
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final String getAlgorithm() {
- return algorithm;
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final Provider getProvider() {
- return provider;
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- * throws NullPointerException if algorithm is null (instead of
- * NoSuchAlgorithmException as in 1.4 release)
- */
- public static final Mac getInstance(String algorithm)
- throws NoSuchAlgorithmException {
- if (algorithm == null) {
- throw new NullPointerException("algorithm is null");
- }
- synchronized (engine) {
- engine.getInstance(algorithm, null);
- return new Mac((MacSpi) engine.spi, engine.provider, algorithm);
- }
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- * throws NullPointerException if algorithm is null (instead of
- * NoSuchAlgorithmException as in 1.4 release)
- */
- public static final Mac getInstance(String algorithm, String provider)
- throws NoSuchAlgorithmException, NoSuchProviderException {
- if ((provider == null) || (provider.length() == 0)) {
- throw new IllegalArgumentException("Provider is null or empty");
- }
- Provider impProvider = Security.getProvider(provider);
- if (impProvider == null) {
- throw new NoSuchProviderException(provider);
- }
- return getInstance(algorithm, impProvider);
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- * throws NullPointerException if algorithm is null (instead of
- * NoSuchAlgorithmException as in 1.4 release)
- */
- public static final Mac getInstance(String algorithm, Provider provider)
- throws NoSuchAlgorithmException {
- if (provider == null) {
- throw new IllegalArgumentException("Provider is null");
- }
- if (algorithm == null) {
- throw new NullPointerException("algorithm is null");
- }
- synchronized (engine) {
- engine.getInstance(algorithm, provider, null);
- return new Mac((MacSpi) engine.spi, provider, algorithm);
- }
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final int getMacLength() {
- return spiImpl.engineGetMacLength();
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final void init(Key key, AlgorithmParameterSpec params)
- throws InvalidKeyException, InvalidAlgorithmParameterException {
- if (key == null) {
- throw new InvalidKeyException("key is null");
- }
- spiImpl.engineInit(key, params);
- isInitMac = true;
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final void init(Key key) throws InvalidKeyException {
- if (key == null) {
- throw new InvalidKeyException("key is null");
- }
- try {
- spiImpl.engineInit(key, null);
- isInitMac = true;
- } catch (InvalidAlgorithmParameterException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final void update(byte input) throws IllegalStateException {
- if (!isInitMac) {
- throw new IllegalStateException(NOTINITMAC);
- }
- spiImpl.engineUpdate(input);
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final void update(byte[] input, int offset, int len)
- throws IllegalStateException {
- if (!isInitMac) {
- throw new IllegalStateException(NOTINITMAC);
- }
- if (input == null) {
- return;
- }
- if ((offset < 0) || (len < 0) || ((offset + len) > input.length)) {
- throw new IllegalArgumentException("Incorrect arguments");
- }
- spiImpl.engineUpdate(input, offset, len);
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final void update(byte[] input) throws IllegalStateException {
- if (!isInitMac) {
- throw new IllegalStateException(NOTINITMAC);
- }
- if (input != null) {
- spiImpl.engineUpdate(input, 0, input.length);
- }
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final void update(ByteBuffer input) {
- if (!isInitMac) {
- throw new IllegalStateException(NOTINITMAC);
- }
- if (input != null) {
- spiImpl.engineUpdate(input);
- } else {
- throw new IllegalArgumentException("input is null");
- }
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final byte[] doFinal() throws IllegalStateException {
- if (!isInitMac) {
- throw new IllegalStateException(NOTINITMAC);
- }
- return spiImpl.engineDoFinal();
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final void doFinal(byte[] output, int outOffset)
- throws ShortBufferException, IllegalStateException {
- if (!isInitMac) {
- throw new IllegalStateException(NOTINITMAC);
- }
- if (output == null) {
- throw new ShortBufferException("Output buffer is null");
- }
- if ((outOffset < 0) || (outOffset >= output.length)) {
- throw new ShortBufferException("Incorrect outOffset parameter: "
- + Integer.toString(outOffset));
- }
- int t = spiImpl.engineGetMacLength();
- if (t > (output.length - outOffset)) {
- throw new ShortBufferException(
- "Output buffer is short. It is needed "
- + Integer.toString(t) + " bytes");
- }
- byte[] result = spiImpl.engineDoFinal();
- System.arraycopy(result, 0, output, outOffset, result.length);
-
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final byte[] doFinal(byte[] input) throws IllegalStateException {
- if (!isInitMac) {
- throw new IllegalStateException("Not initialized Mac");
- }
- if (input != null) {
- spiImpl.engineUpdate(input, 0, input.length);
- }
- return spiImpl.engineDoFinal();
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final void reset() {
- spiImpl.engineReset();
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final Object clone() throws CloneNotSupportedException {
- MacSpi newSpiImpl = (MacSpi)spiImpl.clone();
- Mac mac = new Mac(newSpiImpl, this.provider, this.algorithm);
- mac.isInitMac = this.isInitMac;
- return mac;
- }
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+* @author Vera Y. Petrashkova
+* @version $Revision$
+*/
+
+package javax.crypto;
+
+import java.nio.ByteBuffer;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.Security;
+import java.security.spec.AlgorithmParameterSpec;
+
+import org.apache.harmony.security.fortress.Engine;
+
+
+/**
+ * @com.intel.drl.spec_ref
+ *
+ */
+
+public class Mac implements Cloneable {
+
+ // Store spi implementation service name
+ private static final String SERVICE = "Mac";
+
+ //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 = "MAC was not initialized";
+
+ // Store used provider
+ private final Provider provider;
+
+ // Store used spi implementation
+ private final MacSpi spiImpl;
+
+ // Store used algorithm name
+ private final String algorithm;
+
+ // Store Mac state (initialized or not initialized)
+ private boolean isInitMac;
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ protected Mac(MacSpi macSpi, Provider provider, String algorithm) {
+ this.provider = provider;
+ this.algorithm = algorithm;
+ this.spiImpl = macSpi;
+ this.isInitMac = false;
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final String getAlgorithm() {
+ return algorithm;
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final Provider getProvider() {
+ return provider;
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ * throws NullPointerException if algorithm is null (instead of
+ * NoSuchAlgorithmException as in 1.4 release)
+ */
+ public static final Mac getInstance(String algorithm)
+ throws NoSuchAlgorithmException {
+ if (algorithm == null) {
+ throw new NullPointerException("algorithm is null");
+ }
+ synchronized (engine) {
+ engine.getInstance(algorithm, null);
+ return new Mac((MacSpi) engine.spi, engine.provider, algorithm);
+ }
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ * throws NullPointerException if algorithm is null (instead of
+ * NoSuchAlgorithmException as in 1.4 release)
+ */
+ public static final Mac getInstance(String algorithm, String provider)
+ throws NoSuchAlgorithmException, NoSuchProviderException {
+ if ((provider == null) || (provider.length() == 0)) {
+ throw new IllegalArgumentException("Provider is null or empty");
+ }
+ Provider impProvider = Security.getProvider(provider);
+ if (impProvider == null) {
+ throw new NoSuchProviderException(provider);
+ }
+ return getInstance(algorithm, impProvider);
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ * throws NullPointerException if algorithm is null (instead of
+ * NoSuchAlgorithmException as in 1.4 release)
+ */
+ public static final Mac getInstance(String algorithm, Provider provider)
+ throws NoSuchAlgorithmException {
+ if (provider == null) {
+ throw new IllegalArgumentException("Provider is null");
+ }
+ if (algorithm == null) {
+ throw new NullPointerException("algorithm is null");
+ }
+ synchronized (engine) {
+ engine.getInstance(algorithm, provider, null);
+ return new Mac((MacSpi) engine.spi, provider, algorithm);
+ }
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final int getMacLength() {
+ return spiImpl.engineGetMacLength();
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final void init(Key key, AlgorithmParameterSpec params)
+ throws InvalidKeyException, InvalidAlgorithmParameterException {
+ if (key == null) {
+ throw new InvalidKeyException("key is null");
+ }
+ spiImpl.engineInit(key, params);
+ isInitMac = true;
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final void init(Key key) throws InvalidKeyException {
+ if (key == null) {
+ throw new InvalidKeyException("key is null");
+ }
+ try {
+ spiImpl.engineInit(key, null);
+ isInitMac = true;
+ } catch (InvalidAlgorithmParameterException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final void update(byte input) throws IllegalStateException {
+ if (!isInitMac) {
+ throw new IllegalStateException(NOTINITMAC);
+ }
+ spiImpl.engineUpdate(input);
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final void update(byte[] input, int offset, int len)
+ throws IllegalStateException {
+ if (!isInitMac) {
+ throw new IllegalStateException(NOTINITMAC);
+ }
+ if (input == null) {
+ return;
+ }
+ if ((offset < 0) || (len < 0) || ((offset + len) > input.length)) {
+ throw new IllegalArgumentException("Incorrect arguments");
+ }
+ spiImpl.engineUpdate(input, offset, len);
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final void update(byte[] input) throws IllegalStateException {
+ if (!isInitMac) {
+ throw new IllegalStateException(NOTINITMAC);
+ }
+ if (input != null) {
+ spiImpl.engineUpdate(input, 0, input.length);
+ }
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final void update(ByteBuffer input) {
+ if (!isInitMac) {
+ throw new IllegalStateException(NOTINITMAC);
+ }
+ if (input != null) {
+ spiImpl.engineUpdate(input);
+ } else {
+ throw new IllegalArgumentException("input is null");
+ }
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final byte[] doFinal() throws IllegalStateException {
+ if (!isInitMac) {
+ throw new IllegalStateException(NOTINITMAC);
+ }
+ return spiImpl.engineDoFinal();
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final void doFinal(byte[] output, int outOffset)
+ throws ShortBufferException, IllegalStateException {
+ if (!isInitMac) {
+ throw new IllegalStateException(NOTINITMAC);
+ }
+ if (output == null) {
+ throw new ShortBufferException("Output buffer is null");
+ }
+ if ((outOffset < 0) || (outOffset >= output.length)) {
+ throw new ShortBufferException("Incorrect outOffset parameter: "
+ + Integer.toString(outOffset));
+ }
+ int t = spiImpl.engineGetMacLength();
+ if (t > (output.length - outOffset)) {
+ throw new ShortBufferException(
+ "Output buffer is short. It is needed "
+ + Integer.toString(t) + " bytes");
+ }
+ byte[] result = spiImpl.engineDoFinal();
+ System.arraycopy(result, 0, output, outOffset, result.length);
+
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final byte[] doFinal(byte[] input) throws IllegalStateException {
+ if (!isInitMac) {
+ throw new IllegalStateException("Not initialized Mac");
+ }
+ if (input != null) {
+ spiImpl.engineUpdate(input, 0, input.length);
+ }
+ return spiImpl.engineDoFinal();
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final void reset() {
+ spiImpl.engineReset();
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final Object clone() throws CloneNotSupportedException {
+ MacSpi newSpiImpl = (MacSpi)spiImpl.clone();
+ Mac mac = new Mac(newSpiImpl, this.provider, this.algorithm);
+ mac.isInitMac = this.isInitMac;
+ return mac;
+ }
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/SecretKeyFactory.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/SecretKeyFactory.java?rev=392237&r1=392236&r2=392237&view=diff
==============================================================================
--- 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 Fri Apr 7 03:17:21 2006
@@ -1,162 +1,162 @@
-/*
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
-* @author Vera Y. Petrashkova
-* @version $Revision$
-*/
-
-package javax.crypto;
-
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Provider;
-import java.security.Security;
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.KeySpec;
-
-import org.apache.harmony.security.fortress.Engine;
-
-
-/**
- * @com.intel.drl.spec_ref
- *
- */
-public class SecretKeyFactory {
-
- // Store spi implementation service name
- private static final String SERVICE = "SecretKeyFactory";
-
- // Used to accesess common engine functionality
- private static Engine engine = new Engine(SERVICE);
-
- // Store used provider
- private final Provider provider;
-
- // Store used spi implementation
- private final SecretKeyFactorySpi spiImpl;
-
- // Store used algorithm name
- private final String algorithm;
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- protected SecretKeyFactory(SecretKeyFactorySpi keyFacSpi,
- Provider provider, String algorithm) {
- this.provider = provider;
- this.algorithm = algorithm;
- this.spiImpl = keyFacSpi;
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final String getAlgorithm() {
- return algorithm;
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final Provider getProvider() {
- return provider;
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public static final SecretKeyFactory getInstance(String algorithm)
- throws NoSuchAlgorithmException {
- if (algorithm == null) {
- throw new NullPointerException("Algorithm is null");
- }
- synchronized (engine) {
- engine.getInstance(algorithm, null);
- return new SecretKeyFactory((SecretKeyFactorySpi) engine.spi,
- engine.provider, algorithm);
- }
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public static final SecretKeyFactory getInstance(String algorithm,
- String provider) throws NoSuchAlgorithmException,
- NoSuchProviderException {
- if ((provider == null) || (provider.length() == 0)) {
- throw new IllegalArgumentException("Provider is null or empty");
- }
- Provider impProvider = Security.getProvider(provider);
- if (impProvider == null) {
- throw new NoSuchProviderException(provider);
- }
- return getInstance(algorithm, impProvider);
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public static final SecretKeyFactory getInstance(String algorithm,
- Provider provider) throws NoSuchAlgorithmException {
- if (provider == null) {
- throw new IllegalArgumentException("Provider is null");
- }
- if (algorithm == null) {
- throw new NullPointerException("Algorithm is null");
- }
- synchronized (engine) {
- engine.getInstance(algorithm, provider, null);
- return new SecretKeyFactory((SecretKeyFactorySpi) engine.spi, provider,
- algorithm);
- }
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final SecretKey generateSecret(KeySpec keySpec)
- throws InvalidKeySpecException {
- return spiImpl.engineGenerateSecret(keySpec);
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final KeySpec getKeySpec(SecretKey key, Class keySpec)
- throws InvalidKeySpecException {
- return spiImpl.engineGetKeySpec(key, keySpec);
- }
-
- /**
- * @com.intel.drl.spec_ref
- *
- */
- public final SecretKey translateKey(SecretKey key)
- throws InvalidKeyException {
- return spiImpl.engineTranslateKey(key);
-
- }
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+* @author Vera Y. Petrashkova
+* @version $Revision$
+*/
+
+package javax.crypto;
+
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.Security;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.KeySpec;
+
+import org.apache.harmony.security.fortress.Engine;
+
+
+/**
+ * @com.intel.drl.spec_ref
+ *
+ */
+public class SecretKeyFactory {
+
+ // Store spi implementation service name
+ private static final String SERVICE = "SecretKeyFactory";
+
+ // Used to access common engine functionality
+ private static Engine engine = new Engine(SERVICE);
+
+ // Store used provider
+ private final Provider provider;
+
+ // Store used spi implementation
+ private final SecretKeyFactorySpi spiImpl;
+
+ // Store used algorithm name
+ private final String algorithm;
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ protected SecretKeyFactory(SecretKeyFactorySpi keyFacSpi,
+ Provider provider, String algorithm) {
+ this.provider = provider;
+ this.algorithm = algorithm;
+ this.spiImpl = keyFacSpi;
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final String getAlgorithm() {
+ return algorithm;
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final Provider getProvider() {
+ return provider;
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public static final SecretKeyFactory getInstance(String algorithm)
+ throws NoSuchAlgorithmException {
+ if (algorithm == null) {
+ throw new NullPointerException("Algorithm is null");
+ }
+ synchronized (engine) {
+ engine.getInstance(algorithm, null);
+ return new SecretKeyFactory((SecretKeyFactorySpi) engine.spi,
+ engine.provider, algorithm);
+ }
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public static final SecretKeyFactory getInstance(String algorithm,
+ String provider) throws NoSuchAlgorithmException,
+ NoSuchProviderException {
+ if ((provider == null) || (provider.length() == 0)) {
+ throw new IllegalArgumentException("Provider is null or empty");
+ }
+ Provider impProvider = Security.getProvider(provider);
+ if (impProvider == null) {
+ throw new NoSuchProviderException(provider);
+ }
+ return getInstance(algorithm, impProvider);
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public static final SecretKeyFactory getInstance(String algorithm,
+ Provider provider) throws NoSuchAlgorithmException {
+ if (provider == null) {
+ throw new IllegalArgumentException("Provider is null");
+ }
+ if (algorithm == null) {
+ throw new NullPointerException("Algorithm is null");
+ }
+ synchronized (engine) {
+ engine.getInstance(algorithm, provider, null);
+ return new SecretKeyFactory((SecretKeyFactorySpi) engine.spi, provider,
+ algorithm);
+ }
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final SecretKey generateSecret(KeySpec keySpec)
+ throws InvalidKeySpecException {
+ return spiImpl.engineGenerateSecret(keySpec);
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final KeySpec getKeySpec(SecretKey key, Class keySpec)
+ throws InvalidKeySpecException {
+ return spiImpl.engineGetKeySpec(key, keySpec);
+ }
+
+ /**
+ * @com.intel.drl.spec_ref
+ *
+ */
+ public final SecretKey translateKey(SecretKey key)
+ throws InvalidKeyException {
+ return spiImpl.engineTranslateKey(key);
+
+ }
}