harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r443539 [5/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/src/main/java/common/java/security/Signature.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Signature.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Signature.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Signature.java Thu Sep 14 18:17:39 2006
@@ -1,502 +1,502 @@
-/*
- *  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.nio.ByteBuffer;
-import java.security.cert.Certificate;
-import java.security.cert.X509Certificate;
-import java.security.spec.AlgorithmParameterSpec;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.harmony.security.fortress.Engine;
-
-
-/**
- * @com.intel.drl.spec_ref
- * 
- */
-
-public abstract class Signature extends SignatureSpi {
-    
-    // The service name.
-    private static final String SERVICE = "Signature";
-
-    // Used to access common engine functionality
-    private static Engine engine = new Engine(SERVICE);
-
-    // The provider
-    private Provider provider;
-
-    // The algorithm.
-    private String algorithm;
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected static final int UNINITIALIZED = 0;
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected static final int SIGN = 2;
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected static final int VERIFY = 3;
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected int state = UNINITIALIZED;
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected Signature(String algorithm) {
-        this.algorithm = algorithm;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public static Signature getInstance(String algorithm)
-            throws NoSuchAlgorithmException {
-        if (algorithm == null) {
-            throw new NullPointerException("Algorithm is null");
-        }
-        Signature result;
-        synchronized (engine) {
-            engine.getInstance(algorithm, null);
-            if (engine.spi instanceof Signature) {
-                result = (Signature) engine.spi;
-                result.algorithm = algorithm;
-                result.provider = engine.provider;
-            } else {
-                result = new SignatureImpl((SignatureSpi) engine.spi,
-                        engine.provider, algorithm);
-            }
-        }
-        return result;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public static Signature getInstance(String algorithm, String provider)
-            throws NoSuchAlgorithmException, NoSuchProviderException {
-        if (algorithm == null) {
-            throw new NullPointerException("Algorithm is null");
-        }
-        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 getSignatureInstance(algorithm, p);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public static Signature getInstance(String algorithm, Provider provider)
-            throws NoSuchAlgorithmException {
-        if (algorithm == null) {
-            throw new NullPointerException("Algorithm is null");
-        }
-        if (provider == null) {
-            throw new IllegalArgumentException("Provider is null");
-        }
-        return getSignatureInstance(algorithm, provider);
-    }
-    
-    private static Signature getSignatureInstance(String algorithm,
-            Provider provider) throws NoSuchAlgorithmException {
-        Signature result;
-        synchronized (engine) {
-            engine.getInstance(algorithm, provider, null);
-            if (engine.spi instanceof Signature) {
-                result = (Signature) engine.spi;
-                result.algorithm = algorithm;
-                result.provider = provider;
-            } else {
-                result = new SignatureImpl((SignatureSpi) engine.spi, provider,
-                        algorithm);
-            }
-        }
-        return result;
-    }
-
-    /**
-     * @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 initVerify(PublicKey publicKey)
-            throws InvalidKeyException {
-        engineInitVerify(publicKey);
-        state = VERIFY;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final void initVerify(Certificate certificate)
-            throws InvalidKeyException {
-        if (certificate instanceof X509Certificate) {
-            Set ce = ((X509Certificate) certificate).getCriticalExtensionOIDs();
-            boolean critical = false;
-            if (ce != null && !ce.isEmpty()) {
-                for (Iterator i = ce.iterator(); i.hasNext();) {
-                    if ("2.5.29.15".equals(i.next())) { 
-                        //KeyUsage OID = 2.5.29.15
-                        critical = true;
-                        break;
-                    }
-                }
-                if (critical) {
-                    boolean[] keyUsage = ((X509Certificate) certificate)
-                            .getKeyUsage();
-                    // As specified in RFC 3280 -
-                    // Internet X.509 Public Key Infrastructure
-                    // Certificate and Certificate Revocation List (CRL) Profile.
-                    // (http://www.ietf.org/rfc/rfc3280.txt)
-                    //
-                    // KeyUsage ::= BIT STRING { digitalSignature (0), <skipped> }
-                    if ((keyUsage != null) && (!keyUsage[0])) { // digitalSignature
-                        throw new InvalidKeyException(
-                                "The public key in the certificate cannot be used for digital signature purposes");
-                    }
-                }
-            }
-        }
-        engineInitVerify(certificate.getPublicKey());
-        state = VERIFY;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final void initSign(PrivateKey privateKey)
-            throws InvalidKeyException {
-        engineInitSign(privateKey);
-        state = SIGN;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final void initSign(PrivateKey privateKey, SecureRandom random)
-            throws InvalidKeyException {
-        engineInitSign(privateKey, random);
-        state = SIGN;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final byte[] sign() throws SignatureException {
-        if (state != SIGN) {
-            throw new SignatureException(
-                    "Signature object is not initialized properly.");
-        }
-        return engineSign();
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final int sign(byte[] outbuf, int offset, int len)
-            throws SignatureException {
-        if (state != SIGN) {
-            throw new SignatureException(
-                    "Signature object is not initialized properly.");
-        }
-        if (outbuf == null || offset < 0 || len < 0 ||
-                offset + len > outbuf.length) {
-            throw new IllegalArgumentException(
-                    "Incorrect offset/len parameters");
-        }
-        return engineSign(outbuf, offset, len);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final boolean verify(byte[] signature) throws SignatureException {
-        if (state != VERIFY) {
-            throw new SignatureException(
-                    "Signature object is not initialized properly.");
-        }
-        return engineVerify(signature);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final boolean verify(byte[] signature, int offset, int length)
-            throws SignatureException {
-        if (state != VERIFY) {
-            throw new SignatureException(
-                    "Signature object is not initialized properly.");
-        }
-        if (signature == null || offset < 0 || length < 0 ||
-                offset + length > signature.length) {
-            throw new IllegalArgumentException(
-                    "Incorrect offset/length parameters");
-        }
-        return engineVerify(signature, offset, length);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final void update(byte b) throws SignatureException {
-        if (state == UNINITIALIZED) {
-            throw new SignatureException(
-                    "Signature object is not initialized properly.");
-        }
-        engineUpdate(b);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final void update(byte[] data) throws SignatureException {
-        if (state == UNINITIALIZED) {
-            throw new SignatureException(
-                    "Signature object is not initialized properly.");
-        }
-        engineUpdate(data, 0, data.length);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final void update(byte[] data, int off, int len)
-            throws SignatureException {
-        if (state == UNINITIALIZED) {
-            throw new SignatureException(
-                    "Signature object is not initialized properly.");
-        }
-        if (data == null || off < 0 || len < 0 ||
-                off + len > data.length) {
-            throw new IllegalArgumentException(
-                    "Incorrect offset/len parameters");
-        }
-        engineUpdate(data, off, len);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final void update(ByteBuffer data) throws SignatureException {
-        if (state == UNINITIALIZED) {
-            throw new SignatureException(
-                    "Signature object is not initialized properly.");
-        }
-        engineUpdate(data);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public String toString() {
-        return "SIGNATURE " + algorithm + " state: " + stateToString(state);
-    }
-
-    // Convert state to string
-    private String stateToString(int state) {
-        switch (state) {
-        case UNINITIALIZED:
-            return "UNINITIALIZED";
-        case SIGN:
-            return "SIGN";
-        case VERIFY:
-            return "VERIFY";
-        default:
-            return "";
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     * @deprecated Use {@link Signature#setParameter(AlgorithmParameterSpec) setParameter}
-     */
-    public final void setParameter(String param, Object value)
-            throws InvalidParameterException {
-        engineSetParameter(param, value);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final void setParameter(AlgorithmParameterSpec params)
-            throws InvalidAlgorithmParameterException {
-        engineSetParameter(params);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public final AlgorithmParameters getParameters() {
-        return engineGetParameters();
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     * @deprecated There is no generally accepted parameter naming convention.
-     */
-    public final Object getParameter(String param)
-            throws InvalidParameterException {
-        return engineGetParameter(param);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public Object clone() throws CloneNotSupportedException {
-        if (this instanceof Cloneable) {
-            return super.clone();
-        } else {
-            throw new CloneNotSupportedException();
-        }
-    }
-
-    /**
-     * 
-     * Internal Signature implementation
-     * 
-     */
-    private static class SignatureImpl extends Signature {
-
-        private SignatureSpi spiImpl;
-
-        // Consructor
-        public SignatureImpl(SignatureSpi signatureSpi, Provider provider,
-                String algorithm) {
-            super(algorithm);
-            super.provider = provider;
-            spiImpl = signatureSpi;
-        }
-
-        // engineSign() implementation
-        protected byte[] engineSign() throws SignatureException {
-            return spiImpl.engineSign();
-        }
-
-        //  engineUpdate() implementation
-        protected void engineUpdate(byte arg0) throws SignatureException {
-            spiImpl.engineUpdate(arg0);
-        }
-
-        // engineVerify() implementation
-        protected boolean engineVerify(byte[] arg0) throws SignatureException {
-            return spiImpl.engineVerify(arg0);
-        }
-
-        // engineUpdate() implementation
-        protected void engineUpdate(byte[] arg0, int arg1, int arg2)
-                throws SignatureException {
-            spiImpl.engineUpdate(arg0, arg1, arg2);
-        }
-
-        // engineInitSign() implementation
-        protected void engineInitSign(PrivateKey arg0)
-                throws InvalidKeyException {
-            spiImpl.engineInitSign(arg0);
-        }
-
-        // engineInitVerify() implementation
-        protected void engineInitVerify(PublicKey arg0)
-                throws InvalidKeyException {
-            spiImpl.engineInitVerify(arg0);
-        }
-
-        // engineGetParameter() implementation
-        protected Object engineGetParameter(String arg0)
-                throws InvalidParameterException {
-            return spiImpl.engineGetParameter(arg0);
-        }
-
-        // engineSetParameter() implementation
-        protected void engineSetParameter(String arg0, Object arg1)
-                throws InvalidParameterException {
-            spiImpl.engineSetParameter(arg0, arg1);
-        }
-
-        // Returns a clone if the spiImpl is cloneable
-        public Object clone() throws CloneNotSupportedException {
-            if (spiImpl instanceof Cloneable) {
-                SignatureSpi spi = (SignatureSpi) spiImpl.clone();
-                return new SignatureImpl(spi, getProvider(), getAlgorithm());
-            } else {
-                throw new CloneNotSupportedException();
-            }
-        }
-    }
+/*
+ *  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.nio.ByteBuffer;
+import java.security.cert.Certificate;
+import java.security.cert.X509Certificate;
+import java.security.spec.AlgorithmParameterSpec;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.harmony.security.fortress.Engine;
+
+
+/**
+ * @com.intel.drl.spec_ref
+ * 
+ */
+
+public abstract class Signature extends SignatureSpi {
+    
+    // The service name.
+    private static final String SERVICE = "Signature";
+
+    // Used to access common engine functionality
+    private static Engine engine = new Engine(SERVICE);
+
+    // The provider
+    private Provider provider;
+
+    // The algorithm.
+    private String algorithm;
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected static final int UNINITIALIZED = 0;
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected static final int SIGN = 2;
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected static final int VERIFY = 3;
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected int state = UNINITIALIZED;
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected Signature(String algorithm) {
+        this.algorithm = algorithm;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public static Signature getInstance(String algorithm)
+            throws NoSuchAlgorithmException {
+        if (algorithm == null) {
+            throw new NullPointerException("Algorithm is null");
+        }
+        Signature result;
+        synchronized (engine) {
+            engine.getInstance(algorithm, null);
+            if (engine.spi instanceof Signature) {
+                result = (Signature) engine.spi;
+                result.algorithm = algorithm;
+                result.provider = engine.provider;
+            } else {
+                result = new SignatureImpl((SignatureSpi) engine.spi,
+                        engine.provider, algorithm);
+            }
+        }
+        return result;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public static Signature getInstance(String algorithm, String provider)
+            throws NoSuchAlgorithmException, NoSuchProviderException {
+        if (algorithm == null) {
+            throw new NullPointerException("Algorithm is null");
+        }
+        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 getSignatureInstance(algorithm, p);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public static Signature getInstance(String algorithm, Provider provider)
+            throws NoSuchAlgorithmException {
+        if (algorithm == null) {
+            throw new NullPointerException("Algorithm is null");
+        }
+        if (provider == null) {
+            throw new IllegalArgumentException("Provider is null");
+        }
+        return getSignatureInstance(algorithm, provider);
+    }
+    
+    private static Signature getSignatureInstance(String algorithm,
+            Provider provider) throws NoSuchAlgorithmException {
+        Signature result;
+        synchronized (engine) {
+            engine.getInstance(algorithm, provider, null);
+            if (engine.spi instanceof Signature) {
+                result = (Signature) engine.spi;
+                result.algorithm = algorithm;
+                result.provider = provider;
+            } else {
+                result = new SignatureImpl((SignatureSpi) engine.spi, provider,
+                        algorithm);
+            }
+        }
+        return result;
+    }
+
+    /**
+     * @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 initVerify(PublicKey publicKey)
+            throws InvalidKeyException {
+        engineInitVerify(publicKey);
+        state = VERIFY;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final void initVerify(Certificate certificate)
+            throws InvalidKeyException {
+        if (certificate instanceof X509Certificate) {
+            Set ce = ((X509Certificate) certificate).getCriticalExtensionOIDs();
+            boolean critical = false;
+            if (ce != null && !ce.isEmpty()) {
+                for (Iterator i = ce.iterator(); i.hasNext();) {
+                    if ("2.5.29.15".equals(i.next())) { 
+                        //KeyUsage OID = 2.5.29.15
+                        critical = true;
+                        break;
+                    }
+                }
+                if (critical) {
+                    boolean[] keyUsage = ((X509Certificate) certificate)
+                            .getKeyUsage();
+                    // As specified in RFC 3280 -
+                    // Internet X.509 Public Key Infrastructure
+                    // Certificate and Certificate Revocation List (CRL) Profile.
+                    // (http://www.ietf.org/rfc/rfc3280.txt)
+                    //
+                    // KeyUsage ::= BIT STRING { digitalSignature (0), <skipped> }
+                    if ((keyUsage != null) && (!keyUsage[0])) { // digitalSignature
+                        throw new InvalidKeyException(
+                                "The public key in the certificate cannot be used for digital signature purposes");
+                    }
+                }
+            }
+        }
+        engineInitVerify(certificate.getPublicKey());
+        state = VERIFY;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final void initSign(PrivateKey privateKey)
+            throws InvalidKeyException {
+        engineInitSign(privateKey);
+        state = SIGN;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final void initSign(PrivateKey privateKey, SecureRandom random)
+            throws InvalidKeyException {
+        engineInitSign(privateKey, random);
+        state = SIGN;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final byte[] sign() throws SignatureException {
+        if (state != SIGN) {
+            throw new SignatureException(
+                    "Signature object is not initialized properly.");
+        }
+        return engineSign();
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final int sign(byte[] outbuf, int offset, int len)
+            throws SignatureException {
+        if (state != SIGN) {
+            throw new SignatureException(
+                    "Signature object is not initialized properly.");
+        }
+        if (outbuf == null || offset < 0 || len < 0 ||
+                offset + len > outbuf.length) {
+            throw new IllegalArgumentException(
+                    "Incorrect offset/len parameters");
+        }
+        return engineSign(outbuf, offset, len);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final boolean verify(byte[] signature) throws SignatureException {
+        if (state != VERIFY) {
+            throw new SignatureException(
+                    "Signature object is not initialized properly.");
+        }
+        return engineVerify(signature);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final boolean verify(byte[] signature, int offset, int length)
+            throws SignatureException {
+        if (state != VERIFY) {
+            throw new SignatureException(
+                    "Signature object is not initialized properly.");
+        }
+        if (signature == null || offset < 0 || length < 0 ||
+                offset + length > signature.length) {
+            throw new IllegalArgumentException(
+                    "Incorrect offset/length parameters");
+        }
+        return engineVerify(signature, offset, length);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final void update(byte b) throws SignatureException {
+        if (state == UNINITIALIZED) {
+            throw new SignatureException(
+                    "Signature object is not initialized properly.");
+        }
+        engineUpdate(b);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final void update(byte[] data) throws SignatureException {
+        if (state == UNINITIALIZED) {
+            throw new SignatureException(
+                    "Signature object is not initialized properly.");
+        }
+        engineUpdate(data, 0, data.length);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final void update(byte[] data, int off, int len)
+            throws SignatureException {
+        if (state == UNINITIALIZED) {
+            throw new SignatureException(
+                    "Signature object is not initialized properly.");
+        }
+        if (data == null || off < 0 || len < 0 ||
+                off + len > data.length) {
+            throw new IllegalArgumentException(
+                    "Incorrect offset/len parameters");
+        }
+        engineUpdate(data, off, len);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final void update(ByteBuffer data) throws SignatureException {
+        if (state == UNINITIALIZED) {
+            throw new SignatureException(
+                    "Signature object is not initialized properly.");
+        }
+        engineUpdate(data);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public String toString() {
+        return "SIGNATURE " + algorithm + " state: " + stateToString(state);
+    }
+
+    // Convert state to string
+    private String stateToString(int state) {
+        switch (state) {
+        case UNINITIALIZED:
+            return "UNINITIALIZED";
+        case SIGN:
+            return "SIGN";
+        case VERIFY:
+            return "VERIFY";
+        default:
+            return "";
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     * @deprecated Use {@link Signature#setParameter(AlgorithmParameterSpec) setParameter}
+     */
+    public final void setParameter(String param, Object value)
+            throws InvalidParameterException {
+        engineSetParameter(param, value);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final void setParameter(AlgorithmParameterSpec params)
+            throws InvalidAlgorithmParameterException {
+        engineSetParameter(params);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public final AlgorithmParameters getParameters() {
+        return engineGetParameters();
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     * @deprecated There is no generally accepted parameter naming convention.
+     */
+    public final Object getParameter(String param)
+            throws InvalidParameterException {
+        return engineGetParameter(param);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public Object clone() throws CloneNotSupportedException {
+        if (this instanceof Cloneable) {
+            return super.clone();
+        } else {
+            throw new CloneNotSupportedException();
+        }
+    }
+
+    /**
+     * 
+     * Internal Signature implementation
+     * 
+     */
+    private static class SignatureImpl extends Signature {
+
+        private SignatureSpi spiImpl;
+
+        // Consructor
+        public SignatureImpl(SignatureSpi signatureSpi, Provider provider,
+                String algorithm) {
+            super(algorithm);
+            super.provider = provider;
+            spiImpl = signatureSpi;
+        }
+
+        // engineSign() implementation
+        protected byte[] engineSign() throws SignatureException {
+            return spiImpl.engineSign();
+        }
+
+        //  engineUpdate() implementation
+        protected void engineUpdate(byte arg0) throws SignatureException {
+            spiImpl.engineUpdate(arg0);
+        }
+
+        // engineVerify() implementation
+        protected boolean engineVerify(byte[] arg0) throws SignatureException {
+            return spiImpl.engineVerify(arg0);
+        }
+
+        // engineUpdate() implementation
+        protected void engineUpdate(byte[] arg0, int arg1, int arg2)
+                throws SignatureException {
+            spiImpl.engineUpdate(arg0, arg1, arg2);
+        }
+
+        // engineInitSign() implementation
+        protected void engineInitSign(PrivateKey arg0)
+                throws InvalidKeyException {
+            spiImpl.engineInitSign(arg0);
+        }
+
+        // engineInitVerify() implementation
+        protected void engineInitVerify(PublicKey arg0)
+                throws InvalidKeyException {
+            spiImpl.engineInitVerify(arg0);
+        }
+
+        // engineGetParameter() implementation
+        protected Object engineGetParameter(String arg0)
+                throws InvalidParameterException {
+            return spiImpl.engineGetParameter(arg0);
+        }
+
+        // engineSetParameter() implementation
+        protected void engineSetParameter(String arg0, Object arg1)
+                throws InvalidParameterException {
+            spiImpl.engineSetParameter(arg0, arg1);
+        }
+
+        // Returns a clone if the spiImpl is cloneable
+        public Object clone() throws CloneNotSupportedException {
+            if (spiImpl instanceof Cloneable) {
+                SignatureSpi spi = (SignatureSpi) spiImpl.clone();
+                return new SignatureImpl(spi, getProvider(), getAlgorithm());
+            } else {
+                throw new CloneNotSupportedException();
+            }
+        }
+    }
 }

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

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/SignatureSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/SignatureSpi.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/SignatureSpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/SignatureSpi.java Thu Sep 14 18:17:39 2006
@@ -1,203 +1,203 @@
-/*
- *  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.nio.ByteBuffer;
-import java.security.spec.AlgorithmParameterSpec;
-
-/**
- * @com.intel.drl.spec_ref
- * 
- */
-
-public abstract class SignatureSpi {
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected SecureRandom appRandom;
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected abstract void engineInitVerify(PublicKey publicKey)
-            throws InvalidKeyException;
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected abstract void engineInitSign(PrivateKey privateKey)
-            throws InvalidKeyException;
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected void engineInitSign(PrivateKey privateKey, SecureRandom random)
-            throws InvalidKeyException {
-        appRandom = random;
-        engineInitSign(privateKey);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected abstract void engineUpdate(byte b) throws SignatureException;
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected abstract void engineUpdate(byte[] b, int off, int len)
-            throws SignatureException;
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     * The SignatureException is not specified for this method. 
-     * So throw RuntimeException if underlying engineUpdate(byte[] b, int off, int len)
-     * throws SignatureException.
-     */
-    protected void engineUpdate(ByteBuffer input) {
-        if (!input.hasRemaining()) {
-            return;
-        }
-        byte[] tmp;
-        if (input.hasArray()) {
-            tmp = input.array();
-            int offset = input.arrayOffset();
-            int position = input.position();
-            int limit = input.limit();
-            try {
-                engineUpdate(tmp, offset + position, limit - position);
-            } catch (SignatureException e) { 
-                throw new RuntimeException(e); //Wrap SignatureException
-            }
-            input.position(limit);
-        } else {
-            tmp = new byte[input.limit() - input.position()];
-            input.get(tmp);
-            try {
-                engineUpdate(tmp, 0, tmp.length);
-            } catch (SignatureException e) {
-                throw new RuntimeException(e); //Wrap SignatureException
-            }
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected abstract byte[] engineSign() throws SignatureException;
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected int engineSign(byte[] outbuf, int offset, int len)
-            throws SignatureException {
-        byte tmp[] = engineSign();
-        if (tmp == null) {
-            return 0;
-        }
-        if (len < tmp.length) {
-            throw new SignatureException(
-                    "The value of len parameter is less than the actual signature length");
-        }
-        if (offset < 0) {
-            throw new SignatureException("Invalid negative offset");
-        }
-        if (offset + len > outbuf.length) {
-            throw new SignatureException("Incorrect offset or len value");
-        }
-        System.arraycopy(tmp, 0, outbuf, offset, tmp.length);
-        return tmp.length;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected abstract boolean engineVerify(byte[] sigBytes)
-            throws SignatureException;
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected boolean engineVerify(byte[] sigBytes, int offset, int length)
-            throws SignatureException {
-        byte tmp[] = new byte[length];
-        System.arraycopy(sigBytes, offset, tmp, 0, length);
-        return engineVerify(tmp);
-    }
-
-    /**
-	 * @com.intel.drl.spec_ref
-	 * 
-	 * @deprecated Use
-	 *             {@link SignatureSpi#engineSetParameter(AlgorithmParameterSpec) engineSetParameter}
-	 */
-    protected abstract void engineSetParameter(String param, Object value)
-            throws InvalidParameterException;
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected void engineSetParameter(AlgorithmParameterSpec params)
-            throws InvalidAlgorithmParameterException {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected AlgorithmParameters engineGetParameters() {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-	 * @com.intel.drl.spec_ref
-	 * 
-	 * @deprecated There is no generally accepted parameter naming convention.
-	 */
-    protected abstract Object engineGetParameter(String param)
-            throws InvalidParameterException;
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public Object clone() throws CloneNotSupportedException {
-        if (this instanceof Cloneable) {
-            return super.clone();
-        } else {
-            throw new CloneNotSupportedException();
-        }
-    }
+/*
+ *  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.nio.ByteBuffer;
+import java.security.spec.AlgorithmParameterSpec;
+
+/**
+ * @com.intel.drl.spec_ref
+ * 
+ */
+
+public abstract class SignatureSpi {
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected SecureRandom appRandom;
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected abstract void engineInitVerify(PublicKey publicKey)
+            throws InvalidKeyException;
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected abstract void engineInitSign(PrivateKey privateKey)
+            throws InvalidKeyException;
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected void engineInitSign(PrivateKey privateKey, SecureRandom random)
+            throws InvalidKeyException {
+        appRandom = random;
+        engineInitSign(privateKey);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected abstract void engineUpdate(byte b) throws SignatureException;
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected abstract void engineUpdate(byte[] b, int off, int len)
+            throws SignatureException;
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     * The SignatureException is not specified for this method. 
+     * So throw RuntimeException if underlying engineUpdate(byte[] b, int off, int len)
+     * throws SignatureException.
+     */
+    protected void engineUpdate(ByteBuffer input) {
+        if (!input.hasRemaining()) {
+            return;
+        }
+        byte[] tmp;
+        if (input.hasArray()) {
+            tmp = input.array();
+            int offset = input.arrayOffset();
+            int position = input.position();
+            int limit = input.limit();
+            try {
+                engineUpdate(tmp, offset + position, limit - position);
+            } catch (SignatureException e) { 
+                throw new RuntimeException(e); //Wrap SignatureException
+            }
+            input.position(limit);
+        } else {
+            tmp = new byte[input.limit() - input.position()];
+            input.get(tmp);
+            try {
+                engineUpdate(tmp, 0, tmp.length);
+            } catch (SignatureException e) {
+                throw new RuntimeException(e); //Wrap SignatureException
+            }
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected abstract byte[] engineSign() throws SignatureException;
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected int engineSign(byte[] outbuf, int offset, int len)
+            throws SignatureException {
+        byte tmp[] = engineSign();
+        if (tmp == null) {
+            return 0;
+        }
+        if (len < tmp.length) {
+            throw new SignatureException(
+                    "The value of len parameter is less than the actual signature length");
+        }
+        if (offset < 0) {
+            throw new SignatureException("Invalid negative offset");
+        }
+        if (offset + len > outbuf.length) {
+            throw new SignatureException("Incorrect offset or len value");
+        }
+        System.arraycopy(tmp, 0, outbuf, offset, tmp.length);
+        return tmp.length;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected abstract boolean engineVerify(byte[] sigBytes)
+            throws SignatureException;
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected boolean engineVerify(byte[] sigBytes, int offset, int length)
+            throws SignatureException {
+        byte tmp[] = new byte[length];
+        System.arraycopy(sigBytes, offset, tmp, 0, length);
+        return engineVerify(tmp);
+    }
+
+    /**
+	 * @com.intel.drl.spec_ref
+	 * 
+	 * @deprecated Use
+	 *             {@link SignatureSpi#engineSetParameter(AlgorithmParameterSpec) engineSetParameter}
+	 */
+    protected abstract void engineSetParameter(String param, Object value)
+            throws InvalidParameterException;
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected void engineSetParameter(AlgorithmParameterSpec params)
+            throws InvalidAlgorithmParameterException {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected AlgorithmParameters engineGetParameters() {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+	 * @com.intel.drl.spec_ref
+	 * 
+	 * @deprecated There is no generally accepted parameter naming convention.
+	 */
+    protected abstract Object engineGetParameter(String param)
+            throws InvalidParameterException;
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public Object clone() throws CloneNotSupportedException {
+        if (this instanceof Cloneable) {
+            return super.clone();
+        } else {
+            throw new CloneNotSupportedException();
+        }
+    }
 }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/CertPathBuilder.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/CertPathBuilder.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/CertPathBuilder.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/CertPathBuilder.java Thu Sep 14 18:17:39 2006
@@ -1,169 +1,169 @@
-/*
- *  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.cert;
-
-import java.security.AccessController;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Provider;
-import java.security.Security;
-
-import org.apache.harmony.security.fortress.Engine;
-
-
-/**
- * @com.intel.drl.spec_ref
- * 
- */
-
-public class CertPathBuilder {
-
-    // Store CertPathBuilder service name
-    private static final String SERVICE = "CertPathBuilder";
-
-    // Used to access common engine functionality
-    private static Engine engine = new Engine(SERVICE);
-
-    // Store default property name
-    private static final String PROPERTYNAME = "certpathbuild.type";
-
-    // Default value of CertPathBuilder type. It returns if certpathbuild.type
-    // property is not defined in java.security file
-    private static final String DEFAULTPROPERTY = "PKIX";
-
-    // Store used provider
-    private final Provider provider;
-
-    // Store spi implementation
-    private CertPathBuilderSpi spiImpl;
-
-    // Store algorithm name
-    private final String algorithm;
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    protected CertPathBuilder(CertPathBuilderSpi builderSpi, Provider provider,
-            String algorithm) {
-        this.provider = provider;
-        this.algorithm = algorithm;
-        this.spiImpl = builderSpi;
-    }
-
-    /**
-     * @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 CertPathBuilder getInstance(String algorithm)
-            throws NoSuchAlgorithmException {
-        if (algorithm == null) {
-            throw new NullPointerException("algorithm is null");
-        }
-        synchronized (engine) {
-            engine.getInstance(algorithm, null);
-            return new CertPathBuilder((CertPathBuilderSpi) engine.spi,
-                    engine.provider, algorithm);
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     * throws NullPointerException if algorithm is null (instead of
-     * NoSuchAlgorithmException as in 1.4 release)
-     * 
-     * FIXME: jrockit-j2re1.4.2_04 throws IllegalArgumentException when provider
-     * is empty
-     */
-    public static CertPathBuilder 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 CertPathBuilder 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 CertPathBuilder((CertPathBuilderSpi) engine.spi, provider,
-                    algorithm);
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public final CertPathBuilderResult build(CertPathParameters params)
-            throws CertPathBuilderException, InvalidAlgorithmParameterException {
-        return spiImpl.engineBuild(params);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public static final String getDefaultType() {
-        String defaultType = (String) AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
-                    public Object run() {
-                        return Security.getProperty(PROPERTYNAME);
-                    }
-                }
-            );
-        return (defaultType != null ? defaultType : DEFAULTPROPERTY);
-    }
+/*
+ *  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.cert;
+
+import java.security.AccessController;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.Security;
+
+import org.apache.harmony.security.fortress.Engine;
+
+
+/**
+ * @com.intel.drl.spec_ref
+ * 
+ */
+
+public class CertPathBuilder {
+
+    // Store CertPathBuilder service name
+    private static final String SERVICE = "CertPathBuilder";
+
+    // Used to access common engine functionality
+    private static Engine engine = new Engine(SERVICE);
+
+    // Store default property name
+    private static final String PROPERTYNAME = "certpathbuild.type";
+
+    // Default value of CertPathBuilder type. It returns if certpathbuild.type
+    // property is not defined in java.security file
+    private static final String DEFAULTPROPERTY = "PKIX";
+
+    // Store used provider
+    private final Provider provider;
+
+    // Store spi implementation
+    private CertPathBuilderSpi spiImpl;
+
+    // Store algorithm name
+    private final String algorithm;
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected CertPathBuilder(CertPathBuilderSpi builderSpi, Provider provider,
+            String algorithm) {
+        this.provider = provider;
+        this.algorithm = algorithm;
+        this.spiImpl = builderSpi;
+    }
+
+    /**
+     * @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 CertPathBuilder getInstance(String algorithm)
+            throws NoSuchAlgorithmException {
+        if (algorithm == null) {
+            throw new NullPointerException("algorithm is null");
+        }
+        synchronized (engine) {
+            engine.getInstance(algorithm, null);
+            return new CertPathBuilder((CertPathBuilderSpi) engine.spi,
+                    engine.provider, algorithm);
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     * throws NullPointerException if algorithm is null (instead of
+     * NoSuchAlgorithmException as in 1.4 release)
+     * 
+     * FIXME: jrockit-j2re1.4.2_04 throws IllegalArgumentException when provider
+     * is empty
+     */
+    public static CertPathBuilder 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 CertPathBuilder 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 CertPathBuilder((CertPathBuilderSpi) engine.spi, provider,
+                    algorithm);
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public final CertPathBuilderResult build(CertPathParameters params)
+            throws CertPathBuilderException, InvalidAlgorithmParameterException {
+        return spiImpl.engineBuild(params);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public static final String getDefaultType() {
+        String defaultType = (String) AccessController.doPrivileged(
+                new java.security.PrivilegedAction() {
+                    public Object run() {
+                        return Security.getProperty(PROPERTYNAME);
+                    }
+                }
+            );
+        return (defaultType != null ? defaultType : DEFAULTPROPERTY);
+    }
 }

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

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

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

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

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/CertPathValidator.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/CertPathValidator.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/CertPathValidator.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/CertPathValidator.java Thu Sep 14 18:17:39 2006
@@ -1,168 +1,168 @@
-/*
- *  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.cert;
-
-import java.security.AccessController;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Provider;
-import java.security.Security;
-
-import org.apache.harmony.security.fortress.Engine;
-
-
-/**
- * @com.intel.drl.spec_ref
- * 
- */
-
-public class CertPathValidator {
-    // Store CertPathValidator implementation service name
-    private static final String SERVICE = "CertPathValidator";
-
-    // Used to access common engine functionality
-    private static Engine engine = new Engine(SERVICE);
-
-    // Store default property name
-    private static final String PROPERTYNAME = "certpathvalidator.type";
-
-    // Default value of CertPathBuilder type. It returns if certpathbuild.type
-    // property is not defined in java.security file
-    private static final String DEFAULTPROPERTY = "PKIX";
-
-    // Store used provider
-    private final Provider provider;
-
-    // Store used spi implementation
-    private final CertPathValidatorSpi spiImpl;
-
-    // Store used algorithm value
-    private final String algorithm;
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    protected CertPathValidator(CertPathValidatorSpi validatorSpi,
-            Provider provider, String algorithm) {
-        this.provider = provider;
-        this.algorithm = algorithm;
-        this.spiImpl = validatorSpi;
-    }
-
-    /**
-     * @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
-     */
-    public static CertPathValidator getInstance(String algorithm)
-            throws NoSuchAlgorithmException {
-        if (algorithm == null) {
-            throw new NullPointerException("algorithm is null");
-        }
-        synchronized (engine) {
-            engine.getInstance(algorithm, null);
-            return new CertPathValidator((CertPathValidatorSpi) engine.spi,
-                    engine.provider, algorithm);
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     * throws NullPointerException if algorithm is null
-     */
-    public static CertPathValidator 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
-     */
-    public static CertPathValidator 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 CertPathValidator((CertPathValidatorSpi) engine.spi,
-                    provider, algorithm);
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     */
-    public final CertPathValidatorResult validate(CertPath certPath,
-            CertPathParameters params) throws CertPathValidatorException,
-            InvalidAlgorithmParameterException {
-        return spiImpl.engineValidate(certPath, params);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public static final String getDefaultType() {
-        String defaultType = (String) AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
-                    public Object run() {
-                        return Security.getProperty(PROPERTYNAME);
-                    }
-                }
-            );
-        return (defaultType != null ? defaultType : DEFAULTPROPERTY);
-    }
+/*
+ *  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.cert;
+
+import java.security.AccessController;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.Security;
+
+import org.apache.harmony.security.fortress.Engine;
+
+
+/**
+ * @com.intel.drl.spec_ref
+ * 
+ */
+
+public class CertPathValidator {
+    // Store CertPathValidator implementation service name
+    private static final String SERVICE = "CertPathValidator";
+
+    // Used to access common engine functionality
+    private static Engine engine = new Engine(SERVICE);
+
+    // Store default property name
+    private static final String PROPERTYNAME = "certpathvalidator.type";
+
+    // Default value of CertPathBuilder type. It returns if certpathbuild.type
+    // property is not defined in java.security file
+    private static final String DEFAULTPROPERTY = "PKIX";
+
+    // Store used provider
+    private final Provider provider;
+
+    // Store used spi implementation
+    private final CertPathValidatorSpi spiImpl;
+
+    // Store used algorithm value
+    private final String algorithm;
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    protected CertPathValidator(CertPathValidatorSpi validatorSpi,
+            Provider provider, String algorithm) {
+        this.provider = provider;
+        this.algorithm = algorithm;
+        this.spiImpl = validatorSpi;
+    }
+
+    /**
+     * @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
+     */
+    public static CertPathValidator getInstance(String algorithm)
+            throws NoSuchAlgorithmException {
+        if (algorithm == null) {
+            throw new NullPointerException("algorithm is null");
+        }
+        synchronized (engine) {
+            engine.getInstance(algorithm, null);
+            return new CertPathValidator((CertPathValidatorSpi) engine.spi,
+                    engine.provider, algorithm);
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     * throws NullPointerException if algorithm is null
+     */
+    public static CertPathValidator 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
+     */
+    public static CertPathValidator 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 CertPathValidator((CertPathValidatorSpi) engine.spi,
+                    provider, algorithm);
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     */
+    public final CertPathValidatorResult validate(CertPath certPath,
+            CertPathParameters params) throws CertPathValidatorException,
+            InvalidAlgorithmParameterException {
+        return spiImpl.engineValidate(certPath, params);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     *  
+     */
+    public static final String getDefaultType() {
+        String defaultType = (String) AccessController.doPrivileged(
+                new java.security.PrivilegedAction() {
+                    public Object run() {
+                        return Security.getProperty(PROPERTYNAME);
+                    }
+                }
+            );
+        return (defaultType != null ? defaultType : DEFAULTPROPERTY);
+    }
 }

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

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

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

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

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/CertStore.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/CertStore.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/CertStore.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/CertStore.java Thu Sep 14 18:17:39 2006
@@ -1,212 +1,212 @@
-/*
- *  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.cert;
-
-import java.security.AccessController;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Provider;
-import java.security.Security;
-import java.util.Collection;
-
-import org.apache.harmony.security.fortress.Engine;
-
-
-/**
- * @com.intel.drl.spec_ref
- * 
- */
-
-public class CertStore {
-
-    // Store spi implementation service name
-    private static final String SERVICE = "CertStore";
-
-    // Used to access common engine functionality
-    private static Engine engine = new Engine(SERVICE);
-
-    // Store default property name
-    private static final String PROPERTYNAME = "certstore.type";
-
-    // Default value of CertStore type. It returns if certpathbuild.type
-    // property is not defined in java.security file
-    private static final String DEFAULTPROPERTY = "LDAP";
-
-    // Store used provider
-    private final Provider provider;
-
-    // Store CertStoreSpi implementation
-    private final CertStoreSpi spiImpl;
-
-    // Store used type
-    private final String type;
-
-    // Store used parameters
-    private final CertStoreParameters certStoreParams;
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    protected CertStore(CertStoreSpi storeSpi, Provider provider, String type,
-            CertStoreParameters params) {
-        this.provider = provider;
-        this.type = type;
-        this.spiImpl = storeSpi;
-        this.certStoreParams = params;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     * throws NullPointerException if type is null (instead of
-     * NoSuchAlgorithmException as in 1.4 release)
-     */
-    public static CertStore getInstance(String type, CertStoreParameters params)
-            throws InvalidAlgorithmParameterException, NoSuchAlgorithmException {
-        if (type == null) {
-            throw new NullPointerException("type is null");
-        }
-        try {
-            synchronized (engine) {
-                engine.getInstance(type, params);
-                return new CertStore((CertStoreSpi) engine.spi, engine.provider,
-                        type, params);
-            }
-        } catch (NoSuchAlgorithmException e) {
-            Throwable th = e.getCause();
-            if (th == null) {
-                throw e;
-            } else {
-                throw new InvalidAlgorithmParameterException(e.getMessage(), th);
-            }
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     * throws NullPointerException if type is null (instead of
-     * NoSuchAlgorithmException as in 1.4 release)
-     * 
-     * FIXME: IllegalArgumentException when provider is empty
-     */
-    public static CertStore getInstance(String type,
-            CertStoreParameters params, String provider)
-            throws InvalidAlgorithmParameterException,
-            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(type, params, impProvider);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     * 
-     * throws NullPointerException if type is null (instead of
-     * NoSuchAlgorithmException as in 1.4 release)
-     */
-    public static CertStore getInstance(String type,
-            CertStoreParameters params, Provider provider)
-            throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
-        if (provider == null) {
-            throw new IllegalArgumentException("Provider is null");
-        }
-        if (type == null) {
-            throw new NullPointerException("type is null");
-        }
-        try {
-            synchronized (engine) {
-                engine.getInstance(type, provider, params);
-                return new CertStore((CertStoreSpi) engine.spi, provider, type,
-                        params);
-            }
-        } catch (NoSuchAlgorithmException e) {
-            Throwable th = e.getCause();
-            if (th == null) {
-                throw e;
-            } else {
-                throw new InvalidAlgorithmParameterException(e.getMessage(), th);
-            }
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public final String getType() {
-        return type;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public final Provider getProvider() {
-        return provider;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public final CertStoreParameters getCertStoreParameters() {
-        if (certStoreParams == null) {
-            return null;
-        } else {
-            return (CertStoreParameters) certStoreParams.clone();
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public final Collection<? extends Certificate> getCertificates(CertSelector selector)
-            throws CertStoreException {
-        return spiImpl.engineGetCertificates(selector);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public final Collection<? extends CRL> getCRLs(CRLSelector selector)
-            throws CertStoreException {
-        return spiImpl.engineGetCRLs(selector);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public static final String getDefaultType() {
-        String defaultType = (String) AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
-                    public Object run() {
-                        return Security.getProperty(PROPERTYNAME);
-                    }
-                }
-            );
-        return (defaultType == null ? DEFAULTPROPERTY : defaultType);
-    }
-}
+/*
+ *  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.cert;
+
+import java.security.AccessController;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.Security;
+import java.util.Collection;
+
+import org.apache.harmony.security.fortress.Engine;
+
+
+/**
+ * @com.intel.drl.spec_ref
+ * 
+ */
+
+public class CertStore {
+
+    // Store spi implementation service name
+    private static final String SERVICE = "CertStore";
+
+    // Used to access common engine functionality
+    private static Engine engine = new Engine(SERVICE);
+
+    // Store default property name
+    private static final String PROPERTYNAME = "certstore.type";
+
+    // Default value of CertStore type. It returns if certpathbuild.type
+    // property is not defined in java.security file
+    private static final String DEFAULTPROPERTY = "LDAP";
+
+    // Store used provider
+    private final Provider provider;
+
+    // Store CertStoreSpi implementation
+    private final CertStoreSpi spiImpl;
+
+    // Store used type
+    private final String type;
+
+    // Store used parameters
+    private final CertStoreParameters certStoreParams;
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected CertStore(CertStoreSpi storeSpi, Provider provider, String type,
+            CertStoreParameters params) {
+        this.provider = provider;
+        this.type = type;
+        this.spiImpl = storeSpi;
+        this.certStoreParams = params;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     * throws NullPointerException if type is null (instead of
+     * NoSuchAlgorithmException as in 1.4 release)
+     */
+    public static CertStore getInstance(String type, CertStoreParameters params)
+            throws InvalidAlgorithmParameterException, NoSuchAlgorithmException {
+        if (type == null) {
+            throw new NullPointerException("type is null");
+        }
+        try {
+            synchronized (engine) {
+                engine.getInstance(type, params);
+                return new CertStore((CertStoreSpi) engine.spi, engine.provider,
+                        type, params);
+            }
+        } catch (NoSuchAlgorithmException e) {
+            Throwable th = e.getCause();
+            if (th == null) {
+                throw e;
+            } else {
+                throw new InvalidAlgorithmParameterException(e.getMessage(), th);
+            }
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     * throws NullPointerException if type is null (instead of
+     * NoSuchAlgorithmException as in 1.4 release)
+     * 
+     * FIXME: IllegalArgumentException when provider is empty
+     */
+    public static CertStore getInstance(String type,
+            CertStoreParameters params, String provider)
+            throws InvalidAlgorithmParameterException,
+            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(type, params, impProvider);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     * 
+     * throws NullPointerException if type is null (instead of
+     * NoSuchAlgorithmException as in 1.4 release)
+     */
+    public static CertStore getInstance(String type,
+            CertStoreParameters params, Provider provider)
+            throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
+        if (provider == null) {
+            throw new IllegalArgumentException("Provider is null");
+        }
+        if (type == null) {
+            throw new NullPointerException("type is null");
+        }
+        try {
+            synchronized (engine) {
+                engine.getInstance(type, provider, params);
+                return new CertStore((CertStoreSpi) engine.spi, provider, type,
+                        params);
+            }
+        } catch (NoSuchAlgorithmException e) {
+            Throwable th = e.getCause();
+            if (th == null) {
+                throw e;
+            } else {
+                throw new InvalidAlgorithmParameterException(e.getMessage(), th);
+            }
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public final String getType() {
+        return type;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public final Provider getProvider() {
+        return provider;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public final CertStoreParameters getCertStoreParameters() {
+        if (certStoreParams == null) {
+            return null;
+        } else {
+            return (CertStoreParameters) certStoreParams.clone();
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public final Collection<? extends Certificate> getCertificates(CertSelector selector)
+            throws CertStoreException {
+        return spiImpl.engineGetCertificates(selector);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public final Collection<? extends CRL> getCRLs(CRLSelector selector)
+            throws CertStoreException {
+        return spiImpl.engineGetCRLs(selector);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public static final String getDefaultType() {
+        String defaultType = (String) AccessController.doPrivileged(
+                new java.security.PrivilegedAction() {
+                    public Object run() {
+                        return Security.getProperty(PROPERTYNAME);
+                    }
+                }
+            );
+        return (defaultType == null ? DEFAULTPROPERTY : defaultType);
+    }
+}

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

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

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

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



Mime
View raw message