harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r443539 [2/29] - in /incubator/harmony/enhanced/classlib/trunk/modules/security: ./ .settings/ META-INF/ make/ src/main/java/common/java/security/ src/main/java/common/java/security/acl/ src/main/java/common/java/security/cert/ src/main/jav...
Date Fri, 15 Sep 2006 01:18:16 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/make/hyproperties.xml
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/make/hyproperties.xml?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/make/hyproperties.xml (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/make/hyproperties.xml Thu Sep 14 18:17:39 2006
@@ -1,46 +1,46 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Copyright 2006 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.
--->
-
-<hy>
-   <security location=".">
-      <src>
-         <main>
-             <java location="src/main/java/common" />
-             <native location="src/main/native" />
-    	     <resources location="src/main/resources" />
-         </main>
-         <test location="src/test">
-            <resources location="src/test/resources" />
-         </test>
-      </src>
-      <bin>
-        <main location="bin/main" />
-        <test location="bin/test" />
-      </bin>
-      <packaging>
-        <jarname>security</jarname>
-      </packaging>
-   </security>
-
-   <hdk location="../../deploy" />
-   <jdk location="../../deploy/jdk" />
-   <build location="../../build/classes" />
-
-   <tests>
-      <reports location="../../build/test_report" />
-   </tests>
-</hy>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright 2006 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.
+-->
+
+<hy>
+   <security location=".">
+      <src>
+         <main>
+             <java location="src/main/java/common" />
+             <native location="src/main/native" />
+    	     <resources location="src/main/resources" />
+         </main>
+         <test location="src/test">
+            <resources location="src/test/resources" />
+         </test>
+      </src>
+      <bin>
+        <main location="bin/main" />
+        <test location="bin/test" />
+      </bin>
+      <packaging>
+        <jarname>security</jarname>
+      </packaging>
+   </security>
+
+   <hdk location="../../deploy" />
+   <jdk location="../../deploy/jdk" />
+   <build location="../../build/classes" />
+
+   <tests>
+      <reports location="../../build/test_report" />
+   </tests>
+</hy>

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/make/hyproperties.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/make/patternset.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AccessControlException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AlgorithmParameterGenerator.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AlgorithmParameterGenerator.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AlgorithmParameterGenerator.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AlgorithmParameterGenerator.java Thu Sep 14 18:17:39 2006
@@ -1,183 +1,183 @@
-/*
- *  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 java.security;
-
-import java.security.spec.AlgorithmParameterSpec;
-
-import org.apache.harmony.security.fortress.Engine;
-
-
-/**
- * @com.intel.drl.spec_ref
- * 
- */
-
-public class AlgorithmParameterGenerator {
-
-    // Store spi service name
-    private static final String SERVICE = "AlgorithmParameterGenerator";
-
-    // Used to access common engine functionality
-    private static Engine engine = new Engine(SERVICE);
-
-    // Store SecureRandom
-    private static SecureRandom randm = new SecureRandom();
-
-    // Store used provider
-    private final Provider provider;
-
-    // Store used AlgorithmParameterGeneratorSpi implementation
-    private final AlgorithmParameterGeneratorSpi spiImpl;
-
-    //Store used algorithm
-    private final String algorithm;
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected AlgorithmParameterGenerator(
-            AlgorithmParameterGeneratorSpi paramGenSpi, Provider provider,
-            String algorithm) {
-        this.provider = provider;
-        this.algorithm = algorithm;
-        this.spiImpl = paramGenSpi;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final String getAlgorithm() {
-        return algorithm;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     * throws NullPointerException when algorithm is null
-     */
-    public static AlgorithmParameterGenerator getInstance(String algorithm)
-            throws NoSuchAlgorithmException {
-        if (algorithm == null) {
-            throw new NullPointerException("Algorithm is null");
-        }
-        synchronized (engine) {
-            engine.getInstance(algorithm, null);
-            return new AlgorithmParameterGenerator(
-                    (AlgorithmParameterGeneratorSpi) 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 AlgorithmParameterGenerator getInstance(String algorithm,
-            String provider) throws NoSuchAlgorithmException,
-            NoSuchProviderException {
-        if ((provider == null) || (provider.length() == 0)) {
-            throw new IllegalArgumentException(
-                    "Provider is null or empty string");
-        }
-        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 AlgorithmParameterGenerator 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 AlgorithmParameterGenerator(
-                    (AlgorithmParameterGeneratorSpi) engine.spi, provider,
-                    algorithm);
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final Provider getProvider() {
-        return provider;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final void init(int size) {
-        spiImpl.engineInit(size, randm);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final void init(int size, SecureRandom random) {
-        spiImpl.engineInit(size, random);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final void init(AlgorithmParameterSpec genParamSpec)
-            throws InvalidAlgorithmParameterException {
-        spiImpl.engineInit(genParamSpec, randm);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final void init(AlgorithmParameterSpec genParamSpec,
-            SecureRandom random) throws InvalidAlgorithmParameterException {
-        spiImpl.engineInit(genParamSpec, random);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final AlgorithmParameters generateParameters() {
-        return spiImpl.engineGenerateParameters();
-    }
+/*
+ *  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 java.security;
+
+import java.security.spec.AlgorithmParameterSpec;
+
+import org.apache.harmony.security.fortress.Engine;
+
+
+/**
+ * @com.intel.drl.spec_ref
+ * 
+ */
+
+public class AlgorithmParameterGenerator {
+
+    // Store spi service name
+    private static final String SERVICE = "AlgorithmParameterGenerator";
+
+    // Used to access common engine functionality
+    private static Engine engine = new Engine(SERVICE);
+
+    // Store SecureRandom
+    private static SecureRandom randm = new SecureRandom();
+
+    // Store used provider
+    private final Provider provider;
+
+    // Store used AlgorithmParameterGeneratorSpi implementation
+    private final AlgorithmParameterGeneratorSpi spiImpl;
+
+    //Store used algorithm
+    private final String algorithm;
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected AlgorithmParameterGenerator(
+            AlgorithmParameterGeneratorSpi paramGenSpi, Provider provider,
+            String algorithm) {
+        this.provider = provider;
+        this.algorithm = algorithm;
+        this.spiImpl = paramGenSpi;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final String getAlgorithm() {
+        return algorithm;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     * throws NullPointerException when algorithm is null
+     */
+    public static AlgorithmParameterGenerator getInstance(String algorithm)
+            throws NoSuchAlgorithmException {
+        if (algorithm == null) {
+            throw new NullPointerException("Algorithm is null");
+        }
+        synchronized (engine) {
+            engine.getInstance(algorithm, null);
+            return new AlgorithmParameterGenerator(
+                    (AlgorithmParameterGeneratorSpi) 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 AlgorithmParameterGenerator getInstance(String algorithm,
+            String provider) throws NoSuchAlgorithmException,
+            NoSuchProviderException {
+        if ((provider == null) || (provider.length() == 0)) {
+            throw new IllegalArgumentException(
+                    "Provider is null or empty string");
+        }
+        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 AlgorithmParameterGenerator 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 AlgorithmParameterGenerator(
+                    (AlgorithmParameterGeneratorSpi) engine.spi, provider,
+                    algorithm);
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final Provider getProvider() {
+        return provider;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final void init(int size) {
+        spiImpl.engineInit(size, randm);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final void init(int size, SecureRandom random) {
+        spiImpl.engineInit(size, random);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final void init(AlgorithmParameterSpec genParamSpec)
+            throws InvalidAlgorithmParameterException {
+        spiImpl.engineInit(genParamSpec, randm);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final void init(AlgorithmParameterSpec genParamSpec,
+            SecureRandom random) throws InvalidAlgorithmParameterException {
+        spiImpl.engineInit(genParamSpec, random);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final AlgorithmParameters generateParameters() {
+        return spiImpl.engineGenerateParameters();
+    }
 }

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AlgorithmParameterGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AlgorithmParameterGeneratorSpi.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AlgorithmParameters.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AlgorithmParameters.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AlgorithmParameters.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AlgorithmParameters.java Thu Sep 14 18:17:39 2006
@@ -1,231 +1,231 @@
-/*
- *  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 Boris V. Kuznetsov
-* @version $Revision$
-*/
-
-package java.security;
-
-import java.io.IOException;
-import java.security.spec.AlgorithmParameterSpec;
-import java.security.spec.InvalidParameterSpecException;
-
-import org.apache.harmony.security.fortress.Engine;
-
-
-/**
- * @com.intel.drl.spec_ref
- * 
- */
-
-public class AlgorithmParameters {
-    /**
-     * The service name.
-     */
-    private static final String SEVICE = "AlgorithmParameters";
-
-    /**
-     * Used to access common engine functionality
-     */
-    private static Engine engine = new Engine(SEVICE);
-
-    /**
-     * The provider
-     */
-    private Provider provider;
-
-    /**
-     * The SPI implementation.
-     */
-    private AlgorithmParametersSpi spiImpl;
-
-    /**
-     * The algorithm.
-     */
-    private String algorithm;
-
-    /**
-     * The initialisation state
-     */
-    private boolean initialized; // = false;
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected AlgorithmParameters(AlgorithmParametersSpi keyFacSpi,
-            Provider provider, String algorithm) {
-        this.provider = provider;
-        this.algorithm = algorithm;
-        this.spiImpl = keyFacSpi;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public static AlgorithmParameters getInstance(String algorithm)
-            throws NoSuchAlgorithmException {
-        if (algorithm == null) {
-            throw new NullPointerException("Algorithm is null");
-        }
-        synchronized (engine) {       
-            engine.getInstance(algorithm, null);
-            return new AlgorithmParameters((AlgorithmParametersSpi) engine.spi,
-                    engine.provider, algorithm);
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public static AlgorithmParameters getInstance(String algorithm,
-            String provider) throws NoSuchAlgorithmException,
-            NoSuchProviderException {
-        if ((provider == null) || (provider.length() == 0)) {
-            throw new IllegalArgumentException(
-                    "Provider is null or empty string");
-        }
-        Provider p = Security.getProvider(provider);
-        if (p == null) {
-            throw new NoSuchProviderException("Provider " + provider
-                    + " is not available");
-        }
-        return getInstance(algorithm, p);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public static AlgorithmParameters 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 AlgorithmParameters((AlgorithmParametersSpi) engine.spi,
-                    provider, algorithm);
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final Provider getProvider() {
-        return provider;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final String getAlgorithm() {
-        return algorithm;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final void init(AlgorithmParameterSpec paramSpec)
-            throws InvalidParameterSpecException {
-        if (initialized) {
-            throw new InvalidParameterSpecException(
-                    "Parameter has already been initialized");
-        }
-        spiImpl.engineInit(paramSpec);
-        initialized = true;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final void init(byte[] params) throws IOException {
-        if (initialized) {
-            throw new IOException("Parameter has already been initialized");
-        }
-        spiImpl.engineInit(params);
-        initialized = true;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final void init(byte[] params, String format) throws IOException {
-        if (initialized) {
-            throw new IOException("Parameter has already been initialized");
-        }
-        spiImpl.engineInit(params, format);
-        initialized = true;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final <T extends AlgorithmParameterSpec> T getParameterSpec(Class<T> paramSpec)
-            throws InvalidParameterSpecException {
-        if (!initialized) {
-            throw new InvalidParameterSpecException(
-                    "Parameter has not been initialized");
-        }
-        return spiImpl.engineGetParameterSpec(paramSpec);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final byte[] getEncoded() throws IOException {
-        if (!initialized) {
-            throw new IOException("Parameter has not been initialized");
-        }
-        return spiImpl.engineGetEncoded();
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final byte[] getEncoded(String format) throws IOException {
-        if (!initialized) {
-            throw new IOException("Parameter has not been initialized");
-        }
-        return spiImpl.engineGetEncoded(format);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final String toString() {
-        if (!initialized) {
-            return null;
-        }
-        return spiImpl.engineToString();
-    }
+/*
+ *  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 Boris V. Kuznetsov
+* @version $Revision$
+*/
+
+package java.security;
+
+import java.io.IOException;
+import java.security.spec.AlgorithmParameterSpec;
+import java.security.spec.InvalidParameterSpecException;
+
+import org.apache.harmony.security.fortress.Engine;
+
+
+/**
+ * @com.intel.drl.spec_ref
+ * 
+ */
+
+public class AlgorithmParameters {
+    /**
+     * The service name.
+     */
+    private static final String SEVICE = "AlgorithmParameters";
+
+    /**
+     * Used to access common engine functionality
+     */
+    private static Engine engine = new Engine(SEVICE);
+
+    /**
+     * The provider
+     */
+    private Provider provider;
+
+    /**
+     * The SPI implementation.
+     */
+    private AlgorithmParametersSpi spiImpl;
+
+    /**
+     * The algorithm.
+     */
+    private String algorithm;
+
+    /**
+     * The initialisation state
+     */
+    private boolean initialized; // = false;
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected AlgorithmParameters(AlgorithmParametersSpi keyFacSpi,
+            Provider provider, String algorithm) {
+        this.provider = provider;
+        this.algorithm = algorithm;
+        this.spiImpl = keyFacSpi;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public static AlgorithmParameters getInstance(String algorithm)
+            throws NoSuchAlgorithmException {
+        if (algorithm == null) {
+            throw new NullPointerException("Algorithm is null");
+        }
+        synchronized (engine) {       
+            engine.getInstance(algorithm, null);
+            return new AlgorithmParameters((AlgorithmParametersSpi) engine.spi,
+                    engine.provider, algorithm);
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public static AlgorithmParameters getInstance(String algorithm,
+            String provider) throws NoSuchAlgorithmException,
+            NoSuchProviderException {
+        if ((provider == null) || (provider.length() == 0)) {
+            throw new IllegalArgumentException(
+                    "Provider is null or empty string");
+        }
+        Provider p = Security.getProvider(provider);
+        if (p == null) {
+            throw new NoSuchProviderException("Provider " + provider
+                    + " is not available");
+        }
+        return getInstance(algorithm, p);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public static AlgorithmParameters 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 AlgorithmParameters((AlgorithmParametersSpi) engine.spi,
+                    provider, algorithm);
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final Provider getProvider() {
+        return provider;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final String getAlgorithm() {
+        return algorithm;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final void init(AlgorithmParameterSpec paramSpec)
+            throws InvalidParameterSpecException {
+        if (initialized) {
+            throw new InvalidParameterSpecException(
+                    "Parameter has already been initialized");
+        }
+        spiImpl.engineInit(paramSpec);
+        initialized = true;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final void init(byte[] params) throws IOException {
+        if (initialized) {
+            throw new IOException("Parameter has already been initialized");
+        }
+        spiImpl.engineInit(params);
+        initialized = true;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final void init(byte[] params, String format) throws IOException {
+        if (initialized) {
+            throw new IOException("Parameter has already been initialized");
+        }
+        spiImpl.engineInit(params, format);
+        initialized = true;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final <T extends AlgorithmParameterSpec> T getParameterSpec(Class<T> paramSpec)
+            throws InvalidParameterSpecException {
+        if (!initialized) {
+            throw new InvalidParameterSpecException(
+                    "Parameter has not been initialized");
+        }
+        return spiImpl.engineGetParameterSpec(paramSpec);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final byte[] getEncoded() throws IOException {
+        if (!initialized) {
+            throw new IOException("Parameter has not been initialized");
+        }
+        return spiImpl.engineGetEncoded();
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final byte[] getEncoded(String format) throws IOException {
+        if (!initialized) {
+            throw new IOException("Parameter has not been initialized");
+        }
+        return spiImpl.engineGetEncoded(format);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final String toString() {
+        if (!initialized) {
+            return null;
+        }
+        return spiImpl.engineToString();
+    }
 }

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AlgorithmParameters.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AlgorithmParametersSpi.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/BasicPermission.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Certificate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/CodeSigner.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/CodeSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/DigestException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/DigestInputStream.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/DigestOutputStream.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/DomainCombiner.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/GeneralSecurityException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Guard.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/GuardedObject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Identity.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/IdentityScope.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/InvalidAlgorithmParameterException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/InvalidKeyException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/InvalidParameterException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Key.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyFactory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyFactory.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyFactory.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyFactory.java Thu Sep 14 18:17:39 2006
@@ -1,166 +1,166 @@
-/*
- *  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 Boris V. Kuznetsov
-* @version $Revision$
-*/
-
-package java.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 KeyFactory {
-    // The service name.
-    private static final String SERVICE = "KeyFactory";
-    
-    // The provider
-    private Provider provider;
-    
-    
-    // Used to access common engine functionality
-    static private Engine engine = new Engine(SERVICE);
-    
-    // The SPI implementation.
-    private KeyFactorySpi spiImpl; 
-    
-    // The algorithm.
-    private String algorithm;
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     */
-    protected KeyFactory(KeyFactorySpi keyFacSpi, 
-                         Provider provider,
-                         String algorithm) {
-        this.provider = provider;
-        this. algorithm = algorithm;
-        this.spiImpl = keyFacSpi;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     */
-    public static KeyFactory getInstance(String algorithm)
-                                throws NoSuchAlgorithmException {
-        if (algorithm == null) {
-            throw new NullPointerException("Algorithm is null");
-        }
-        synchronized (engine) {
-            engine.getInstance(algorithm, null);
-            return new KeyFactory((KeyFactorySpi)engine.spi, engine.provider, algorithm);
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     */
-    public static KeyFactory getInstance(String algorithm, String provider)
-                                throws NoSuchAlgorithmException, NoSuchProviderException {
-        if ((provider == null) || (provider.length() == 0)) {
-            throw new IllegalArgumentException(
-                    "Provider is null or empty string");
-        }
-        Provider p = Security.getProvider(provider);
-        if (p == null) {
-            throw new NoSuchProviderException("Provider "+ provider + " is not available"); 
-        }
-        return getInstance(algorithm, p);    
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     */
-    public static KeyFactory 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 KeyFactory((KeyFactorySpi)engine.spi, provider, algorithm);
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     */
-    public final Provider getProvider() {
-        return provider;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     */
-    public final String getAlgorithm() {
-        return algorithm;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     */
-    public final PublicKey generatePublic(KeySpec keySpec)
-                                throws InvalidKeySpecException {
-        return spiImpl.engineGeneratePublic(keySpec);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     */
-    public final PrivateKey generatePrivate(KeySpec keySpec)
-                                throws InvalidKeySpecException {
-        return spiImpl.engineGeneratePrivate(keySpec);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     */
-    public final <T extends KeySpec> T getKeySpec(Key key,
-                                    Class<T> keySpec)
-                            throws InvalidKeySpecException {
-        return spiImpl.engineGetKeySpec(key, keySpec);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     */
-    public final Key translateKey(Key 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 Boris V. Kuznetsov
+* @version $Revision$
+*/
+
+package java.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 KeyFactory {
+    // The service name.
+    private static final String SERVICE = "KeyFactory";
+    
+    // The provider
+    private Provider provider;
+    
+    
+    // Used to access common engine functionality
+    static private Engine engine = new Engine(SERVICE);
+    
+    // The SPI implementation.
+    private KeyFactorySpi spiImpl; 
+    
+    // The algorithm.
+    private String algorithm;
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     */
+    protected KeyFactory(KeyFactorySpi keyFacSpi, 
+                         Provider provider,
+                         String algorithm) {
+        this.provider = provider;
+        this. algorithm = algorithm;
+        this.spiImpl = keyFacSpi;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     */
+    public static KeyFactory getInstance(String algorithm)
+                                throws NoSuchAlgorithmException {
+        if (algorithm == null) {
+            throw new NullPointerException("Algorithm is null");
+        }
+        synchronized (engine) {
+            engine.getInstance(algorithm, null);
+            return new KeyFactory((KeyFactorySpi)engine.spi, engine.provider, algorithm);
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     */
+    public static KeyFactory getInstance(String algorithm, String provider)
+                                throws NoSuchAlgorithmException, NoSuchProviderException {
+        if ((provider == null) || (provider.length() == 0)) {
+            throw new IllegalArgumentException(
+                    "Provider is null or empty string");
+        }
+        Provider p = Security.getProvider(provider);
+        if (p == null) {
+            throw new NoSuchProviderException("Provider "+ provider + " is not available"); 
+        }
+        return getInstance(algorithm, p);    
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     */
+    public static KeyFactory 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 KeyFactory((KeyFactorySpi)engine.spi, provider, algorithm);
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     */
+    public final Provider getProvider() {
+        return provider;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     */
+    public final String getAlgorithm() {
+        return algorithm;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     */
+    public final PublicKey generatePublic(KeySpec keySpec)
+                                throws InvalidKeySpecException {
+        return spiImpl.engineGeneratePublic(keySpec);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     */
+    public final PrivateKey generatePrivate(KeySpec keySpec)
+                                throws InvalidKeySpecException {
+        return spiImpl.engineGeneratePrivate(keySpec);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     */
+    public final <T extends KeySpec> T getKeySpec(Key key,
+                                    Class<T> keySpec)
+                            throws InvalidKeySpecException {
+        return spiImpl.engineGetKeySpec(key, keySpec);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     */
+    public final Key translateKey(Key key)
+                        throws InvalidKeyException {
+        return spiImpl.engineTranslateKey(key);
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyFactorySpi.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyManagementException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyPair.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyPairGenerator.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyPairGenerator.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyPairGenerator.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyPairGenerator.java Thu Sep 14 18:17:39 2006
@@ -1,236 +1,236 @@
-/*
- *  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 java.security;
-
-import java.security.spec.AlgorithmParameterSpec;
-
-import org.apache.harmony.security.fortress.Engine;
-
-
-/**
- * 
- * @com.intel.drl.spec_ref
- * 
- */
-public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
-
-    // Store KeyPairGenerator SERVICE name
-    private static final String SERVICE = "KeyPairGenerator";
-
-    // Used to access common engine functionality
-    private static Engine engine = new Engine(SERVICE);
-
-    // Store SecureRandom
-    private static SecureRandom random = new SecureRandom();
-
-    // Store used ptovider
-    private Provider provider;
-
-    // Store used algorithm
-    private String algorithm;
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected KeyPairGenerator(String algorithm) {
-        this.algorithm = algorithm;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public String getAlgorithm() {
-        return algorithm;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     * throws NullPointerException when algorithm is null
-     */
-    public static KeyPairGenerator getInstance(String algorithm)
-            throws NoSuchAlgorithmException {
-        if (algorithm == null) {
-            throw new NullPointerException("algorithm is null");
-        }
-        KeyPairGenerator result;
-        synchronized (engine) {
-            engine.getInstance(algorithm, null);
-            if (engine.spi instanceof KeyPairGenerator) {
-                result = (KeyPairGenerator) engine.spi;
-                result.algorithm = algorithm;
-                result.provider = engine.provider;
-                return result;
-            } else {
-                result = new KeyPairGeneratorImpl((KeyPairGeneratorSpi) engine.spi,
-                        engine.provider, algorithm);
-                return result;
-            }
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     * throws NullPointerException if algorithm is null (instead of
-     * NoSuchAlgorithmException) as in 1.4 release
-     */
-    public static KeyPairGenerator getInstance(String algorithm, String provider)
-            throws NoSuchAlgorithmException, NoSuchProviderException {
-        if ((provider == null) || (provider.length() == 0)) {
-            throw new IllegalArgumentException(
-                    "Provider is null or empty string");
-        }
-        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 KeyPairGenerator 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");
-        }
-        KeyPairGenerator result;
-        synchronized (engine) {
-            engine.getInstance(algorithm, provider, null);
-            if (engine.spi instanceof KeyPairGenerator) {
-                result = (KeyPairGenerator) engine.spi;
-                result.algorithm = algorithm;
-                result.provider = provider;
-                return result;
-            } else {
-                result = new KeyPairGeneratorImpl((KeyPairGeneratorSpi) engine.spi,
-                        provider, algorithm);
-                return result;
-            }
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final Provider getProvider() {
-        return provider;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public void initialize(int keysize) {
-        initialize(keysize, random);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public void initialize(AlgorithmParameterSpec param)
-            throws InvalidAlgorithmParameterException {
-        initialize(param, random);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final KeyPair genKeyPair() {
-        return generateKeyPair();
-    }
-
-    public KeyPair generateKeyPair() {
-        return null;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public void initialize(int keysize, SecureRandom random) {
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public void initialize(AlgorithmParameterSpec param, SecureRandom random)
-            throws InvalidAlgorithmParameterException {
-    }
-
-    /**
-     * 
-     * Internal class: KeyPairGenerator implementation
-     * 
-     */
-    private static class KeyPairGeneratorImpl extends KeyPairGenerator {
-        // Save KeyPairGeneratorSpi
-        private KeyPairGeneratorSpi spiImpl;
-
-        // Implementation of KeyPaiGenerator constructor
-        // 
-        // @param KeyPairGeneratorSpi
-        // @param provider
-        // @param algorithm
-        private KeyPairGeneratorImpl(KeyPairGeneratorSpi keyPairGeneratorSpi,
-                Provider provider, String algorithm) {
-            super(algorithm);
-            super.provider = provider;
-            spiImpl = keyPairGeneratorSpi;
-        }
-
-        // implementation of initialize(int keysize, SecureRandom random)
-        // using corresponding spi initialize() method
-        public void initialize(int keysize, SecureRandom random) {
-            spiImpl.initialize(keysize, random);
-        }
-
-        // implementation of generateKeyPair()
-        // using corresponding spi generateKeyPair() method
-        public KeyPair generateKeyPair() {
-            return spiImpl.generateKeyPair();
-        }
-
-        // implementation of initialize(int keysize, SecureRandom random)
-        // using corresponding spi initialize() method
-        public void initialize(AlgorithmParameterSpec param, SecureRandom random)
-                throws InvalidAlgorithmParameterException {
-            spiImpl.initialize(param, 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 java.security;
+
+import java.security.spec.AlgorithmParameterSpec;
+
+import org.apache.harmony.security.fortress.Engine;
+
+
+/**
+ * 
+ * @com.intel.drl.spec_ref
+ * 
+ */
+public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
+
+    // Store KeyPairGenerator SERVICE name
+    private static final String SERVICE = "KeyPairGenerator";
+
+    // Used to access common engine functionality
+    private static Engine engine = new Engine(SERVICE);
+
+    // Store SecureRandom
+    private static SecureRandom random = new SecureRandom();
+
+    // Store used ptovider
+    private Provider provider;
+
+    // Store used algorithm
+    private String algorithm;
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected KeyPairGenerator(String algorithm) {
+        this.algorithm = algorithm;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public String getAlgorithm() {
+        return algorithm;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     * throws NullPointerException when algorithm is null
+     */
+    public static KeyPairGenerator getInstance(String algorithm)
+            throws NoSuchAlgorithmException {
+        if (algorithm == null) {
+            throw new NullPointerException("algorithm is null");
+        }
+        KeyPairGenerator result;
+        synchronized (engine) {
+            engine.getInstance(algorithm, null);
+            if (engine.spi instanceof KeyPairGenerator) {
+                result = (KeyPairGenerator) engine.spi;
+                result.algorithm = algorithm;
+                result.provider = engine.provider;
+                return result;
+            } else {
+                result = new KeyPairGeneratorImpl((KeyPairGeneratorSpi) engine.spi,
+                        engine.provider, algorithm);
+                return result;
+            }
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     * throws NullPointerException if algorithm is null (instead of
+     * NoSuchAlgorithmException) as in 1.4 release
+     */
+    public static KeyPairGenerator getInstance(String algorithm, String provider)
+            throws NoSuchAlgorithmException, NoSuchProviderException {
+        if ((provider == null) || (provider.length() == 0)) {
+            throw new IllegalArgumentException(
+                    "Provider is null or empty string");
+        }
+        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 KeyPairGenerator 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");
+        }
+        KeyPairGenerator result;
+        synchronized (engine) {
+            engine.getInstance(algorithm, provider, null);
+            if (engine.spi instanceof KeyPairGenerator) {
+                result = (KeyPairGenerator) engine.spi;
+                result.algorithm = algorithm;
+                result.provider = provider;
+                return result;
+            } else {
+                result = new KeyPairGeneratorImpl((KeyPairGeneratorSpi) engine.spi,
+                        provider, algorithm);
+                return result;
+            }
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final Provider getProvider() {
+        return provider;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public void initialize(int keysize) {
+        initialize(keysize, random);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public void initialize(AlgorithmParameterSpec param)
+            throws InvalidAlgorithmParameterException {
+        initialize(param, random);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final KeyPair genKeyPair() {
+        return generateKeyPair();
+    }
+
+    public KeyPair generateKeyPair() {
+        return null;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public void initialize(int keysize, SecureRandom random) {
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public void initialize(AlgorithmParameterSpec param, SecureRandom random)
+            throws InvalidAlgorithmParameterException {
+    }
+
+    /**
+     * 
+     * Internal class: KeyPairGenerator implementation
+     * 
+     */
+    private static class KeyPairGeneratorImpl extends KeyPairGenerator {
+        // Save KeyPairGeneratorSpi
+        private KeyPairGeneratorSpi spiImpl;
+
+        // Implementation of KeyPaiGenerator constructor
+        // 
+        // @param KeyPairGeneratorSpi
+        // @param provider
+        // @param algorithm
+        private KeyPairGeneratorImpl(KeyPairGeneratorSpi keyPairGeneratorSpi,
+                Provider provider, String algorithm) {
+            super(algorithm);
+            super.provider = provider;
+            spiImpl = keyPairGeneratorSpi;
+        }
+
+        // implementation of initialize(int keysize, SecureRandom random)
+        // using corresponding spi initialize() method
+        public void initialize(int keysize, SecureRandom random) {
+            spiImpl.initialize(keysize, random);
+        }
+
+        // implementation of generateKeyPair()
+        // using corresponding spi generateKeyPair() method
+        public KeyPair generateKeyPair() {
+            return spiImpl.generateKeyPair();
+        }
+
+        // implementation of initialize(int keysize, SecureRandom random)
+        // using corresponding spi initialize() method
+        public void initialize(AlgorithmParameterSpec param, SecureRandom random)
+                throws InvalidAlgorithmParameterException {
+            spiImpl.initialize(param, random);
+        }
+
+    }
+
 }

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyPairGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyPairGeneratorSpi.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyRep.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message