harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r443539 [6/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
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/Certificate.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/javax/security/cert/X509Certificate.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/javax/security/cert/X509Certificate.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/javax/security/cert/X509Certificate.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/javax/security/cert/X509Certificate.java Thu Sep 14 18:17:39 2006
@@ -1,270 +1,270 @@
-/*
- *  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 Alexander Y. Kleymenov
-* @version $Revision$
-*/
-
-package javax.security.cert;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.lang.reflect.Constructor;
-import java.math.BigInteger;
-import java.security.AccessController;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Principal;
-import java.security.PublicKey;
-import java.security.Security;
-import java.security.SignatureException;
-import java.security.cert.CertificateFactory;
-import java.util.Date;
-import javax.security.cert.Certificate;
-import javax.security.cert.CertificateEncodingException;
-import javax.security.cert.CertificateException;
-import javax.security.cert.CertificateExpiredException;
-import javax.security.cert.CertificateNotYetValidException;
-
-/**
- * @com.intel.drl.spec_ref
- */
-public abstract class X509Certificate extends Certificate {
-
-    private static Constructor constructor;
-    
-    static {
-        try {
-            String classname = (String) AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
-                    public Object run() {
-                        return Security.getProperty("cert.provider.x509v1");
-                    }
-                }
-            );
-            Class cl = Class.forName(classname);
-            constructor =
-                cl.getConstructor(new Class[] {InputStream.class});
-        } catch (Throwable e) {
-        }
-    }
-    
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public X509Certificate() {
-        super();
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public static final X509Certificate getInstance(InputStream inStream)
-                                             throws CertificateException {
-        if (inStream == null) {
-            throw new CertificateException("The stream should not be null");
-        }
-        if (constructor != null) {
-            try {
-                return (X509Certificate) 
-                    constructor.newInstance(new Object[] {inStream});
-            } catch (Throwable e) {
-                throw new CertificateException(e.getMessage());
-            }
-        }
-
-        final java.security.cert.X509Certificate cert;
-        try {
-            CertificateFactory cf = CertificateFactory.getInstance("X.509");
-            cert = (java.security.cert.X509Certificate)
-                                            cf.generateCertificate(inStream);
-        } catch (java.security.cert.CertificateException e) {
-            throw new CertificateException(e.getMessage());
-        }
-
-        return new X509Certificate() {
-
-            public byte[] getEncoded() throws CertificateEncodingException {
-                try {
-                    return cert.getEncoded();
-                } catch (java.security.cert.CertificateEncodingException e) {
-                    throw new CertificateEncodingException(e.getMessage());
-                }
-            }
-
-            public void verify(PublicKey key) throws CertificateException,
-                                NoSuchAlgorithmException, InvalidKeyException,
-                                NoSuchProviderException, SignatureException {
-                try {
-                    cert.verify(key);
-                } catch (java.security.cert.CertificateException e) {
-                    throw new CertificateException(e.getMessage());
-                }
-            }
-
-            public void verify(PublicKey key, String sigProvider)
-                            throws CertificateException,
-                                NoSuchAlgorithmException, InvalidKeyException,
-                                NoSuchProviderException, SignatureException {
-                try {
-                    cert.verify(key, sigProvider);
-                } catch (java.security.cert.CertificateException e) {
-                    throw new CertificateException(e.getMessage());
-                }
-            }
-
-            public String toString() {
-                return cert.toString();
-            }
-
-            public PublicKey getPublicKey() {
-                return cert.getPublicKey();
-            }
-
-            public void checkValidity() throws CertificateExpiredException,
-                                   CertificateNotYetValidException {
-                try {
-                    cert.checkValidity();
-                } catch (java.security.cert.CertificateNotYetValidException e) {
-                    throw new CertificateNotYetValidException(e.getMessage());
-                } catch (java.security.cert.CertificateExpiredException e) {
-                    throw new CertificateExpiredException(e.getMessage());
-                }
-            }
-
-            public void checkValidity(Date date) 
-                            throws CertificateExpiredException,
-                                   CertificateNotYetValidException {
-                try {
-                    cert.checkValidity(date);
-                } catch (java.security.cert.CertificateNotYetValidException e) {
-                    throw new CertificateNotYetValidException(e.getMessage());
-                } catch (java.security.cert.CertificateExpiredException e) {
-                    throw new CertificateExpiredException(e.getMessage());
-                }
-            }
-
-            public int getVersion() {
-                return 2;
-            }
-
-            public BigInteger getSerialNumber() {
-                return cert.getSerialNumber();
-            }
-
-            public Principal getIssuerDN() {
-                return cert.getIssuerDN();
-            }
-
-            public Principal getSubjectDN() {
-                return cert.getSubjectDN();
-            }
-
-            public Date getNotBefore() {
-                return cert.getNotBefore();
-            }
-
-            public Date getNotAfter() {
-                return cert.getNotAfter();
-            }
-
-            public String getSigAlgName() {
-                return cert.getSigAlgName();
-            }
-
-            public String getSigAlgOID() {
-                return cert.getSigAlgOID();
-            }
-
-            public byte[] getSigAlgParams() {
-                return cert.getSigAlgParams();
-            }
-        };
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public static final X509Certificate getInstance(byte[] certData)
-                                             throws CertificateException {
-        if (certData == null) {
-            throw new CertificateException("The data should not be null");
-        }
-        ByteArrayInputStream bais = new ByteArrayInputStream(certData);
-        return getInstance(bais);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public abstract void checkValidity()
-            throws CertificateExpiredException, CertificateNotYetValidException;
-
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public abstract void checkValidity(Date date)
-            throws CertificateExpiredException, CertificateNotYetValidException;
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public abstract int getVersion();
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public abstract BigInteger getSerialNumber();
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public abstract Principal getIssuerDN();
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public abstract Principal getSubjectDN();
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public abstract Date getNotBefore();
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public abstract Date getNotAfter();
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public abstract String getSigAlgName();
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public abstract String getSigAlgOID();
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public abstract byte[] getSigAlgParams();
-}
-
+/*
+ *  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 Alexander Y. Kleymenov
+* @version $Revision$
+*/
+
+package javax.security.cert;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.math.BigInteger;
+import java.security.AccessController;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Principal;
+import java.security.PublicKey;
+import java.security.Security;
+import java.security.SignatureException;
+import java.security.cert.CertificateFactory;
+import java.util.Date;
+import javax.security.cert.Certificate;
+import javax.security.cert.CertificateEncodingException;
+import javax.security.cert.CertificateException;
+import javax.security.cert.CertificateExpiredException;
+import javax.security.cert.CertificateNotYetValidException;
+
+/**
+ * @com.intel.drl.spec_ref
+ */
+public abstract class X509Certificate extends Certificate {
+
+    private static Constructor constructor;
+    
+    static {
+        try {
+            String classname = (String) AccessController.doPrivileged(
+                new java.security.PrivilegedAction() {
+                    public Object run() {
+                        return Security.getProperty("cert.provider.x509v1");
+                    }
+                }
+            );
+            Class cl = Class.forName(classname);
+            constructor =
+                cl.getConstructor(new Class[] {InputStream.class});
+        } catch (Throwable e) {
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public X509Certificate() {
+        super();
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public static final X509Certificate getInstance(InputStream inStream)
+                                             throws CertificateException {
+        if (inStream == null) {
+            throw new CertificateException("The stream should not be null");
+        }
+        if (constructor != null) {
+            try {
+                return (X509Certificate) 
+                    constructor.newInstance(new Object[] {inStream});
+            } catch (Throwable e) {
+                throw new CertificateException(e.getMessage());
+            }
+        }
+
+        final java.security.cert.X509Certificate cert;
+        try {
+            CertificateFactory cf = CertificateFactory.getInstance("X.509");
+            cert = (java.security.cert.X509Certificate)
+                                            cf.generateCertificate(inStream);
+        } catch (java.security.cert.CertificateException e) {
+            throw new CertificateException(e.getMessage());
+        }
+
+        return new X509Certificate() {
+
+            public byte[] getEncoded() throws CertificateEncodingException {
+                try {
+                    return cert.getEncoded();
+                } catch (java.security.cert.CertificateEncodingException e) {
+                    throw new CertificateEncodingException(e.getMessage());
+                }
+            }
+
+            public void verify(PublicKey key) throws CertificateException,
+                                NoSuchAlgorithmException, InvalidKeyException,
+                                NoSuchProviderException, SignatureException {
+                try {
+                    cert.verify(key);
+                } catch (java.security.cert.CertificateException e) {
+                    throw new CertificateException(e.getMessage());
+                }
+            }
+
+            public void verify(PublicKey key, String sigProvider)
+                            throws CertificateException,
+                                NoSuchAlgorithmException, InvalidKeyException,
+                                NoSuchProviderException, SignatureException {
+                try {
+                    cert.verify(key, sigProvider);
+                } catch (java.security.cert.CertificateException e) {
+                    throw new CertificateException(e.getMessage());
+                }
+            }
+
+            public String toString() {
+                return cert.toString();
+            }
+
+            public PublicKey getPublicKey() {
+                return cert.getPublicKey();
+            }
+
+            public void checkValidity() throws CertificateExpiredException,
+                                   CertificateNotYetValidException {
+                try {
+                    cert.checkValidity();
+                } catch (java.security.cert.CertificateNotYetValidException e) {
+                    throw new CertificateNotYetValidException(e.getMessage());
+                } catch (java.security.cert.CertificateExpiredException e) {
+                    throw new CertificateExpiredException(e.getMessage());
+                }
+            }
+
+            public void checkValidity(Date date) 
+                            throws CertificateExpiredException,
+                                   CertificateNotYetValidException {
+                try {
+                    cert.checkValidity(date);
+                } catch (java.security.cert.CertificateNotYetValidException e) {
+                    throw new CertificateNotYetValidException(e.getMessage());
+                } catch (java.security.cert.CertificateExpiredException e) {
+                    throw new CertificateExpiredException(e.getMessage());
+                }
+            }
+
+            public int getVersion() {
+                return 2;
+            }
+
+            public BigInteger getSerialNumber() {
+                return cert.getSerialNumber();
+            }
+
+            public Principal getIssuerDN() {
+                return cert.getIssuerDN();
+            }
+
+            public Principal getSubjectDN() {
+                return cert.getSubjectDN();
+            }
+
+            public Date getNotBefore() {
+                return cert.getNotBefore();
+            }
+
+            public Date getNotAfter() {
+                return cert.getNotAfter();
+            }
+
+            public String getSigAlgName() {
+                return cert.getSigAlgName();
+            }
+
+            public String getSigAlgOID() {
+                return cert.getSigAlgOID();
+            }
+
+            public byte[] getSigAlgParams() {
+                return cert.getSigAlgParams();
+            }
+        };
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public static final X509Certificate getInstance(byte[] certData)
+                                             throws CertificateException {
+        if (certData == null) {
+            throw new CertificateException("The data should not be null");
+        }
+        ByteArrayInputStream bais = new ByteArrayInputStream(certData);
+        return getInstance(bais);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public abstract void checkValidity()
+            throws CertificateExpiredException, CertificateNotYetValidException;
+
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public abstract void checkValidity(Date date)
+            throws CertificateExpiredException, CertificateNotYetValidException;
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public abstract int getVersion();
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public abstract BigInteger getSerialNumber();
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public abstract Principal getIssuerDN();
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public abstract Principal getSubjectDN();
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public abstract Date getNotBefore();
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public abstract Date getNotAfter();
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public abstract String getSigAlgName();
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public abstract String getSigAlgOID();
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public abstract byte[] getSigAlgParams();
+}
+

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

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

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

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

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

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

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

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

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

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Services.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Services.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Services.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Services.java Thu Sep 14 18:17:39 2006
@@ -1,251 +1,251 @@
-/*
- *  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 org.apache.harmony.security.fortress;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.Provider;
-import java.security.Security;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-
-/**
- * This class contains information about all registered providers and preferred
- * implementations for all "serviceName.algName".
- * 
- */
-
-public class Services {
-
-    // The HashMap that contains information about preferred implementations for
-    // all serviceName.algName in the registered providers
-    private static final Map<String, Provider.Service> services = new HashMap<String, Provider.Service>(512);
-
-    // Need refresh flag
-    private static boolean needRefresh; // = false;
-
-    /**
-     * Refresh number
-     */
-    public static int refreshNumber = 1;
-
-    // Registered providers
-    private static final List<Provider> providers = new ArrayList<Provider>(20);
-
-    // Hash for quick provider access by name
-    private static final Map<String, Provider> providersNames = new HashMap<String, Provider>(20);
-
-    static {
-        AccessController.doPrivileged(new PrivilegedAction<Object>() {
-            public Object run() {
-                loadProviders();
-                return null;
-            }
-        });
-    }
-
-    // Load statically registered providers and init Services Info
-    private static void loadProviders() {
-        String providerClassName = null;
-        int i = 1;
-        ClassLoader cl = ClassLoader.getSystemClassLoader();
-        Provider p;
-
-        while ((providerClassName = Security.getProperty("security.provider."
-                + i++)) != null) {
-            try {
-                p = (Provider) Class
-                        .forName(providerClassName.trim(), true, cl)
-                        .newInstance();
-                providers.add(p);
-                providersNames.put(p.getName(), p);
-                initServiceInfo(p);
-            } catch (Exception e) { // ignore
-            }
-        }
-        Engine.door.renumProviders();
-    }
-
-    /**
-     * Returns registered providers
-     * 
-     * @return
-     */
-    public static Provider[] getProviders() {
-        return providers.toArray(new Provider[providers.size()]);
-    }
-
-    /**
-     * Returns registered providers as List
-     * 
-     * @return
-     */
-    public static List<Provider> getProvidersList() {
-        return new ArrayList<Provider>(providers);
-    }
-
-    /**
-     * Returns the provider with the specified name
-     * 
-     * @param name
-     * @return
-     */
-    public static Provider getProvider(String name) {
-        if (name == null) {
-            return null;
-        }
-        return providersNames.get(name);
-    }
-
-    /**
-     * Inserts a provider at a specified position
-     * 
-     * @param provider
-     * @param position
-     * @return
-     */
-    public static int insertProviderAt(Provider provider, int position) {
-        int size = providers.size();
-        if ((position < 1) || (position > size)) {
-            position = size + 1;
-        }
-        providers.add(position - 1, provider);
-        providersNames.put(provider.getName(), provider);
-        setNeedRefresh();
-        return position;
-    }
-
-    /**
-     * Removes the provider
-     * 
-     * @param providerNumber
-     */
-    public static void removeProvider(int providerNumber) {
-        Provider p = providers.remove(providerNumber - 1);
-        providersNames.remove(p.getName());
-        setNeedRefresh();
-    }
-
-    /**
-     * 
-     * Adds information about provider services into HashMap.
-     * 
-     * @param p
-     */
-    public static void initServiceInfo(Provider p) {
-        Provider.Service serv;
-        String key;
-        String type;
-        String alias;
-        StringBuffer sb = new StringBuffer(128);
-
-        for (Iterator<Provider.Service> it1 = p.getServices().iterator(); it1.hasNext();) {
-            serv = it1.next();
-            type = serv.getType();
-            sb.delete(0, sb.length());
-            key = sb.append(type).append(".").append(
-                    serv.getAlgorithm().toUpperCase()).toString();
-            if (!services.containsKey(key)) {
-                services.put(key, serv);
-            }
-            for (Iterator<String> it2 = Engine.door.getAliases(serv); it2.hasNext();) {
-                alias = it2.next();
-                sb.delete(0, sb.length());
-                key = sb.append(type).append(".").append(alias.toUpperCase())
-                        .toString();
-                if (!services.containsKey(key)) {
-                    services.put(key, serv);
-                }
-            }
-        }
-    }
-
-    /**
-     * 
-     * Updates services hashtable for all registered providers
-     *  
-     */
-    public static void updateServiceInfo() {
-        services.clear();
-        for (Iterator<Provider> it = providers.iterator(); it.hasNext();) {
-            initServiceInfo(it.next());
-        }
-        needRefresh = false;
-    }
-
-    /**
-     * Returns true if services contain any provider information  
-     * @return
-     */
-    public static boolean isEmpty() {
-        return services.isEmpty();
-    }
-    
-    /**
-     * 
-     * Returns service description.
-     * Call refresh() before.
-     * 
-     * @param key
-     * @return
-     */
-    public static Provider.Service getService(String key) {
-        return services.get(key);
-    }
-
-    /**
-     * Prints Services content  
-     */
-    // FIXME remove debug function
-    public static void printServices() {
-        refresh();
-        Set<String> s = services.keySet();
-        for (Iterator<String> i = s.iterator(); i.hasNext();) {
-            String key = i.next();
-            System.out.println(key + "=" + services.get(key));
-        }
-    }
-
-    /**
-     * Set flag needRefresh 
-     *
-     */
-    public static void setNeedRefresh() {
-        needRefresh = true;
-    }
-
-    /**
-     * Refresh services info
-     *
-     */
-    public static void refresh() {
-        if (needRefresh) {
-            refreshNumber++;
-            updateServiceInfo();
-        }
-    }
+/*
+ *  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 org.apache.harmony.security.fortress;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.Provider;
+import java.security.Security;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * This class contains information about all registered providers and preferred
+ * implementations for all "serviceName.algName".
+ * 
+ */
+
+public class Services {
+
+    // The HashMap that contains information about preferred implementations for
+    // all serviceName.algName in the registered providers
+    private static final Map<String, Provider.Service> services = new HashMap<String, Provider.Service>(512);
+
+    // Need refresh flag
+    private static boolean needRefresh; // = false;
+
+    /**
+     * Refresh number
+     */
+    public static int refreshNumber = 1;
+
+    // Registered providers
+    private static final List<Provider> providers = new ArrayList<Provider>(20);
+
+    // Hash for quick provider access by name
+    private static final Map<String, Provider> providersNames = new HashMap<String, Provider>(20);
+
+    static {
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
+            public Object run() {
+                loadProviders();
+                return null;
+            }
+        });
+    }
+
+    // Load statically registered providers and init Services Info
+    private static void loadProviders() {
+        String providerClassName = null;
+        int i = 1;
+        ClassLoader cl = ClassLoader.getSystemClassLoader();
+        Provider p;
+
+        while ((providerClassName = Security.getProperty("security.provider."
+                + i++)) != null) {
+            try {
+                p = (Provider) Class
+                        .forName(providerClassName.trim(), true, cl)
+                        .newInstance();
+                providers.add(p);
+                providersNames.put(p.getName(), p);
+                initServiceInfo(p);
+            } catch (Exception e) { // ignore
+            }
+        }
+        Engine.door.renumProviders();
+    }
+
+    /**
+     * Returns registered providers
+     * 
+     * @return
+     */
+    public static Provider[] getProviders() {
+        return providers.toArray(new Provider[providers.size()]);
+    }
+
+    /**
+     * Returns registered providers as List
+     * 
+     * @return
+     */
+    public static List<Provider> getProvidersList() {
+        return new ArrayList<Provider>(providers);
+    }
+
+    /**
+     * Returns the provider with the specified name
+     * 
+     * @param name
+     * @return
+     */
+    public static Provider getProvider(String name) {
+        if (name == null) {
+            return null;
+        }
+        return providersNames.get(name);
+    }
+
+    /**
+     * Inserts a provider at a specified position
+     * 
+     * @param provider
+     * @param position
+     * @return
+     */
+    public static int insertProviderAt(Provider provider, int position) {
+        int size = providers.size();
+        if ((position < 1) || (position > size)) {
+            position = size + 1;
+        }
+        providers.add(position - 1, provider);
+        providersNames.put(provider.getName(), provider);
+        setNeedRefresh();
+        return position;
+    }
+
+    /**
+     * Removes the provider
+     * 
+     * @param providerNumber
+     */
+    public static void removeProvider(int providerNumber) {
+        Provider p = providers.remove(providerNumber - 1);
+        providersNames.remove(p.getName());
+        setNeedRefresh();
+    }
+
+    /**
+     * 
+     * Adds information about provider services into HashMap.
+     * 
+     * @param p
+     */
+    public static void initServiceInfo(Provider p) {
+        Provider.Service serv;
+        String key;
+        String type;
+        String alias;
+        StringBuffer sb = new StringBuffer(128);
+
+        for (Iterator<Provider.Service> it1 = p.getServices().iterator(); it1.hasNext();) {
+            serv = it1.next();
+            type = serv.getType();
+            sb.delete(0, sb.length());
+            key = sb.append(type).append(".").append(
+                    serv.getAlgorithm().toUpperCase()).toString();
+            if (!services.containsKey(key)) {
+                services.put(key, serv);
+            }
+            for (Iterator<String> it2 = Engine.door.getAliases(serv); it2.hasNext();) {
+                alias = it2.next();
+                sb.delete(0, sb.length());
+                key = sb.append(type).append(".").append(alias.toUpperCase())
+                        .toString();
+                if (!services.containsKey(key)) {
+                    services.put(key, serv);
+                }
+            }
+        }
+    }
+
+    /**
+     * 
+     * Updates services hashtable for all registered providers
+     *  
+     */
+    public static void updateServiceInfo() {
+        services.clear();
+        for (Iterator<Provider> it = providers.iterator(); it.hasNext();) {
+            initServiceInfo(it.next());
+        }
+        needRefresh = false;
+    }
+
+    /**
+     * Returns true if services contain any provider information  
+     * @return
+     */
+    public static boolean isEmpty() {
+        return services.isEmpty();
+    }
+    
+    /**
+     * 
+     * Returns service description.
+     * Call refresh() before.
+     * 
+     * @param key
+     * @return
+     */
+    public static Provider.Service getService(String key) {
+        return services.get(key);
+    }
+
+    /**
+     * Prints Services content  
+     */
+    // FIXME remove debug function
+    public static void printServices() {
+        refresh();
+        Set<String> s = services.keySet();
+        for (Iterator<String> i = s.iterator(); i.hasNext();) {
+            String key = i.next();
+            System.out.println(key + "=" + services.get(key));
+        }
+    }
+
+    /**
+     * Set flag needRefresh 
+     *
+     */
+    public static void setNeedRefresh() {
+        needRefresh = true;
+    }
+
+    /**
+     * Refresh services info
+     *
+     */
+    public static void refresh() {
+        if (needRefresh) {
+            refreshNumber++;
+            updateServiceInfo();
+        }
+    }
 }

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

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

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

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

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

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

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

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

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/linux/org/apache/harmony/security/provider/crypto/RandomBitsSupplier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/windows/org/apache/harmony/security/provider/crypto/RandomBitsSupplier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/native/security/windows/getWindowsRandom.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/native/security/windows/hysecurity.def
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/native/security/windows/hysecurity.def?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/native/security/windows/hysecurity.def (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/native/security/windows/hysecurity.def Thu Sep 14 18:17:39 2006
@@ -1,8 +1,8 @@
-LIBRARY	HYSECURITY
-
-SECTIONS
-	.data	READ WRITE
-	.text	EXECUTE READ
-
-EXPORTS
-	Java_org_apache_harmony_security_provider_crypto_RandomBitsSupplier_getWindowsRandom
+LIBRARY	HYSECURITY
+
+SECTIONS
+	.data	READ WRITE
+	.text	EXECUTE READ
+
+EXPORTS
+	Java_org_apache_harmony_security_provider_crypto_RandomBitsSupplier_getWindowsRandom

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/native/security/windows/hysecurity.def
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/native/security/windows/security_copyright.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/AlgorithmParameterGeneratorSpiTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/AllPermissionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/BasicPermissionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/IdentityTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/IdentityTest.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/IdentityTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/IdentityTest.java Thu Sep 14 18:17:39 2006
@@ -1,427 +1,427 @@
-/*
- *  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 Aleksei Y. Semenov
-* @version $Revision$
-*/
-
-package java.security;
-
-
-
-import org.apache.harmony.security.tests.support.CertificateStub;
-import org.apache.harmony.security.tests.support.IdentityStub;
-import org.apache.harmony.security.tests.support.PublicKeyStub;
-
-import junit.framework.TestCase;
-
-/**
- * Tests for class Identity
- * 
- */
-
-public class IdentityTest extends TestCase {
-
-    public static class MySecurityManager extends SecurityManager {
-        public Permissions denied = new Permissions(); 
-        public void checkPermission(Permission permission){
-            if (denied!=null && denied.implies(permission)) throw new SecurityException();
-        }
-    }
-    
-    public static void main(String[] args) {
-        junit.textui.TestRunner.run(IdentityTest.class);
-    }
-
-    /**
-     * Constructor for IdentityTest.
-     * @param name
-     */
-    public IdentityTest(String name) {
-        super(name);
-    }
-
-    public void testHashCode() {
-        new IdentityStub("testHashCode").hashCode();
-    }
-
-    public void testEquals() throws Exception {
-        Identity i1 = new IdentityStub("testEquals");
-        Object value[] =  {
-                null, Boolean.FALSE,
-                new Object(), Boolean.FALSE,
-                i1, Boolean.TRUE,
-                new IdentityStub(i1.getName()), Boolean.TRUE
-        };
-        
-        for (int k=0; k<value.length; k+=2) {
-            assertEquals(value[k+1], new Boolean(i1.equals(value[k])));
-            if (Boolean.TRUE.equals(value[k+1])) assertEquals(i1.hashCode(), value[k].hashCode());
-        }
-        // check other cases
-        Identity i2 = new IdentityStub("testEquals", IdentityScope.getSystemScope());
-        assertEquals(i1.identityEquals(i2), i1.equals(i2));
-        Identity i3 = new IdentityStub("testEquals3");
-        assertEquals(i1.identityEquals(i3), i1.equals(i3));
-        
-    }
-
-    /**
-     * verify Identity.toString() throws Exception is permission is denied
-     */
-    public void testToString1() {
-        MySecurityManager sm = new MySecurityManager();
-        sm.denied.add(new SecurityPermission("printIdentity"));
-        System.setSecurityManager(sm);
-        try {
-            new IdentityStub("testToString").toString();
-            fail("SecurityException should be thrown");
-        } catch (SecurityException ok) {
-        } finally {
-            System.setSecurityManager(null);
-        }          
-    }
-    /**
-     * verify Identity.toString() 
-     */
-    public void testToString2() {    
-        assertNotNull(new IdentityStub("testToString2").toString());
-    }
-
-    /**
-     * verify Identity() creates instance
-     */
-    public void testIdentity() {
-        assertNotNull(new IdentityStub());
-    }
-
-    /*
-     * Cverify Identity(String) creates instance with given name
-     */
-    public void testIdentityString() {
-        Identity i = new IdentityStub("iii");
-        assertNotNull(i);
-        assertEquals("iii", i.getName());
-        i=new IdentityStub(null);
-        assertNotNull(i);
-        assertNull(i.getName());
-    }
-
-    /**
-     * verify Identity(String, IdentityScope) creates instance with given name and in give scope
-     */
-    public void testIdentityStringIdentityScope() throws Exception {
-        IdentityScope s = IdentityScope.getSystemScope();        
-        Identity i = new IdentityStub("iii2", s);
-        assertNotNull(i);
-        assertEquals("iii2", i.getName());
-        assertSame(s, i.getScope());
-        assertSame(i, s.getIdentity(i.getName()));        
-    }
-
-    /**
-     * verify addCertificate(Certificate certificate) adds a certificate for this identity.
-     * If the identity has a public key, the public key in the certificate must be the same
-     *  
-     */
-    public void testAddCertificate1() throws Exception {
-        Identity i = new IdentityStub("iii");
-        PublicKeyStub pk1 = new PublicKeyStub("kkk", "fff", new byte[]{1,2,3,4,5});
-        i.setPublicKey(pk1);
-        // try with the same key
-        CertificateStub c1 = new CertificateStub("fff", null, null, pk1);
-        i.addCertificate(c1);
-        assertSame(c1, i.certificates()[0]);
-        // try Certificate with different key
-        try {
-            i.addCertificate(new CertificateStub("ccc", null, null, new PublicKeyStub("k2", "fff", new byte[]{6,7,8,9,0})));
-            fail("KeyManagementException should be thrown");
-        } catch (KeyManagementException ok) {}        
-    }
-
-    /**
-     * verify addCertificate(Certificate certificate) adds a certificate for this identity.
-     * if the identity does not have a public key, the identity's public key is set to be that specified in the certificate.
-     */
-    public void testAddCertificate2() throws Exception {
-        Identity i = new IdentityStub("iii");
-        PublicKeyStub pk1 = new PublicKeyStub("kkk", "fff", null);        
-        CertificateStub c1 = new CertificateStub("fff", null, null, pk1);
-        i.addCertificate(c1);
-        assertSame(c1, i.certificates()[0]);
-        assertSame(pk1, i.getPublicKey());
-        	
-    }
-    
-    /**
-     * verify addCertificate(Certificate certificate) throws SecurityException is permission is denied
-     */
-    public void testAddCertificate3() throws Exception {
-        MySecurityManager sm = new MySecurityManager();
-        sm.denied.add(new SecurityPermission("addIdentityCertificate"));
-        System.setSecurityManager(sm);
-        try {
-            new IdentityStub("iii").addCertificate(new CertificateStub("ccc", null, null, null));
-            fail("SecurityException should be thrown");
-        } catch (SecurityException ok) {
-        } finally {
-            System.setSecurityManager(null);
-        }        
-    }
-    
-    /**
-     * verify addCertificate(Certificate certificate) throws KeyManagementException if certificate is null
-     */
-    public void testAddCertificate4() throws Exception {
-        try {
-            new IdentityStub("aaa").addCertificate(null);
-            fail("KeyManagementException should be thrown");
-        } catch (KeyManagementException ok) {
-        } catch (NullPointerException ok) {}
-        
-    }
-//
-//  Commented out since there will no be fix for the test failure    
-//    /**
-//     * verify removeCertificate(Certificate certificate) removes cetrificate
-//     */
-//    public void testRemoveCertificate1() throws Exception{
-//        Identity i = new IdentityStub("iii");
-//        PublicKeyStub pk1 = new PublicKeyStub("kkk", "fff", null);        
-//        CertificateStub c1 = new CertificateStub("fff", null, null, pk1);
-//        i.addCertificate(c1);
-//        assertSame(c1, i.certificates()[0]);
-//        i.removeCertificate(c1);
-//        assertEquals(0, i.certificates().length);
-//        // throw KeyManagementException if certificate not found
-//        try {
-//            i.removeCertificate(c1);
-//            fail("KeyManagementException should be thrown");
-//        } catch (KeyManagementException ok) {     
-//        }
-//        try {
-//            i.removeCertificate(null);
-//            fail("KeyManagementException should be thrown");
-//        } catch (KeyManagementException ok) {
-//            
-//        }
-//    }
-    /**
-     * verify removeCertificate(Certificate certificate) throws SecurityException if permission is denied
-     */
-    public void testRemoveCertificate2() throws Exception{
-        MySecurityManager sm = new MySecurityManager();
-        sm.denied.add(new SecurityPermission("removeIdentityCertificate"));
-        Identity i = new IdentityStub("iii");
-        i.addCertificate(new CertificateStub("ccc", null, null, null));
-        System.setSecurityManager(sm);
-        try {
-            i.removeCertificate(i.certificates()[0]);
-            fail("SecurityException should be thrown");
-        } catch (SecurityException ok) {
-        } finally {
-            System.setSecurityManager(null);
-        }
-        
-    }
-
-    /**
-     * verify certificates() returns a copy of all certificates for this identity
-     */
-    public void testCertificates() throws Exception {
-        Identity i = new IdentityStub("iii");
-        PublicKeyStub pk1 = new PublicKeyStub("kkk", "fff", null);        
-        CertificateStub c1 = new CertificateStub("fff", null, null, pk1);
-        CertificateStub c2 = new CertificateStub("zzz", null, null, pk1);
-        i.addCertificate(c1);
-        i.addCertificate(c2);
-        Certificate[] s = i.certificates();
-        assertEquals(2, s.length);
-        assertTrue(c1.equals(s[0]) || c2.equals(s[0]));
-        assertTrue(c1.equals(s[1]) || c2.equals(s[1]));
-        s[0] = null;
-        s[1] = null;
-        // check that the copy was modified
-        s = i.certificates();
-        assertEquals(2, s.length);
-        assertTrue(c1.equals(s[0]) || c2.equals(s[0]));
-        assertTrue(c1.equals(s[1]) || c2.equals(s[1]));
-    }
-
-    /**
-     * verify Identity.identityEquals(Identity) return true, only if names and public keys are equal 
-     */
-    
-    public void testIdentityEquals() throws Exception {
-        String name = "nnn";
-        PublicKey pk = new PublicKeyStub("aaa", "fff", new byte[]{1,2,3,4,5});
-        Identity i = new IdentityStub(name);
-        i.setPublicKey(pk);
-        Object[] value = {
-                //null, Boolean.FALSE,
-                //new Object(), Boolean.FALSE,
-                new IdentityStub("111"), Boolean.FALSE,
-                new IdentityStub(name), Boolean.FALSE,
-                new IdentityStub(name, IdentityScope.getSystemScope()), Boolean.FALSE,
-                i, Boolean.TRUE,
-                new IdentityStub(name, pk), Boolean.TRUE                
-        };
-        for (int k=0; k<value.length; k+=2){
-            assertEquals(value[k+1], new Boolean(i.identityEquals((Identity)value[k])));
-            if (Boolean.TRUE.equals(value[k+1])) assertEquals(i.hashCode(), value[k].hashCode());
-        }
-        Identity i2 = IdentityScope.getSystemScope().getIdentity(name); 
-        i2.setPublicKey(pk);        
-        assertTrue(i.identityEquals(i2));
-    }
-
-    /**
-     * verify Identity.toString(boolean) return string representation of identity
-     */
-    public void testToStringboolean() throws Exception {
-        new IdentityStub("aaa").toString(false);
-        new IdentityStub("aaa2", IdentityScope.getSystemScope()).toString(false);
-        new IdentityStub("bbb").toString(true);
-        new IdentityStub("bbb2", IdentityScope.getSystemScope()).toString(true);
-    }
-
-    /**
-     * verify Identity.getScope() returns identity's scope
-     */    
-    public void testGetScope() throws Exception {
-       Identity i = new IdentityStub("testGetScope");
-       assertNull(i.getScope());
-       IdentityScope s = IdentityScope.getSystemScope();
-       
-       Identity i2 = new IdentityStub("testGetScope2", s);
-       assertSame(s, i2.getScope());
-        
-    }
-    /**
-     * 
-     * verify Identity.setPublicKey() throws SecurityException if permission is denied
-     *
-     */
-    public void testSetPublicKey1() throws Exception {
-        MySecurityManager sm = new MySecurityManager();
-        sm.denied.add(new SecurityPermission("setIdentityPublicKey"));
-        System.setSecurityManager(sm);
-        try {
-            new IdentityStub("testSetPublicKey1").setPublicKey(new PublicKeyStub("kkk", "testSetPublicKey1", null));
-            fail("SecurityException should be thrown");
-        } catch (SecurityException ok) {
-        } finally {
-            System.setSecurityManager(null);
-        }        
-    
-    }
-    /**
-     * 
-     * verify Identity.setPublicKey() throws KeyManagementException if key is invalid 
-     *
-     */
-    public void testSetPublicKey2() throws Exception {
-        Identity i2 = new IdentityStub("testSetPublicKey2_2", IdentityScope.getSystemScope());
-        new PublicKeyStub("kkk", "testSetPublicKey2", new byte[]{1,2,3,4,5});
-        try {
-            i2.setPublicKey(null);
-            //fail("KeyManagementException should be thrown - key is null");            
-        } catch (KeyManagementException ok) {}
-    }
-    
-//
-//  Commented out since there will no be fix for the test failure       
-//    /**
-//     * 
-//     * verify Identity.setPublicKey() throws KeyManagementException if key is already used 
-//     *
-//     */
-//    public void testSetPublicKey3() throws Exception {
-//        Identity i1 = new IdentityStub("testSetPublicKey3_1", IdentityScope.getSystemScope());
-//        Identity i2 = new IdentityStub("testSetPublicKey3_2", IdentityScope.getSystemScope());
-//        PublicKey pk = new PublicKeyStub("kkk", "fff", new byte[]{1,2,3,4,5});
-//        i1.setPublicKey(pk);
-//        try {
-//            i2.setPublicKey(pk);
-//            fail("KeyManagementException should be thrown - key already used");            
-//        } catch (KeyManagementException ok) {};
-//    }
-    /**
-     * 
-     * verify Identity.setPublicKey()  removes old key and all identity's certificates
-     *
-     */
-    public void testSetPublicKey4() throws Exception {
-        Identity i = new IdentityStub("testSetPublicKey4");
-        PublicKeyStub pk1 = new PublicKeyStub("kkk", "Identity.testSetPublicKey4", null);        
-        CertificateStub c1 = new CertificateStub("fff", null, null, pk1);
-        CertificateStub c2 = new CertificateStub("zzz", null, null, pk1);
-        i.addCertificate(c1);
-        i.addCertificate(c2);
-        assertEquals(2, i.certificates().length);
-        assertSame(pk1, i.getPublicKey());
-        
-        PublicKeyStub pk2 = new PublicKeyStub("zzz", "Identity.testSetPublicKey4", null);    
-        i.setPublicKey(pk2);
-        assertSame(pk2, i.getPublicKey());
-        assertEquals(0, i.certificates().length);
-    }
-    
-    /**
-     * verify Identity.getPublicKey() returns public key
-     */
-    
-    public void testGetPublicKey() throws Exception {
-        Identity i = new IdentityStub("testGetPublicKey");
-        assertNull(i.getPublicKey());
-        PublicKey pk = new PublicKeyStub("kkk", "Identity.testGetPublicKey", null);
-        i.setPublicKey(pk);
-        assertSame(pk, i.getPublicKey());        
-    }
-
-    /**
-     * 
-     * verify Identity.setInfo() throws SecurityException if permission is denied
-     *
-     *
-     */
-    public void testSetInfo() throws Exception {
-        MySecurityManager sm = new MySecurityManager();
-        sm.denied.add(new SecurityPermission("setIdentityInfo"));
-        System.setSecurityManager(sm);
-        try {
-            new IdentityStub("testSetInfo").setInfo("some info");
-            fail("SecurityException should be thrown");
-        } catch (SecurityException ok) {
-        } finally {
-            System.setSecurityManager(null);
-        }        
-    }
-
-    public void testGetInfo() {
-        
-        Identity i = new IdentityStub("testGetInfo");
-        i.setInfo("some info");
-        assertEquals("some info", i.getInfo());
-    }
-    
-    public void testGetName() {
-        Identity i = new IdentityStub("testGetName");
-        assertEquals ("testGetName", i.getName());
-    }
-
-}
+/*
+ *  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 Aleksei Y. Semenov
+* @version $Revision$
+*/
+
+package java.security;
+
+
+
+import org.apache.harmony.security.tests.support.CertificateStub;
+import org.apache.harmony.security.tests.support.IdentityStub;
+import org.apache.harmony.security.tests.support.PublicKeyStub;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for class Identity
+ * 
+ */
+
+public class IdentityTest extends TestCase {
+
+    public static class MySecurityManager extends SecurityManager {
+        public Permissions denied = new Permissions(); 
+        public void checkPermission(Permission permission){
+            if (denied!=null && denied.implies(permission)) throw new SecurityException();
+        }
+    }
+    
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(IdentityTest.class);
+    }
+
+    /**
+     * Constructor for IdentityTest.
+     * @param name
+     */
+    public IdentityTest(String name) {
+        super(name);
+    }
+
+    public void testHashCode() {
+        new IdentityStub("testHashCode").hashCode();
+    }
+
+    public void testEquals() throws Exception {
+        Identity i1 = new IdentityStub("testEquals");
+        Object value[] =  {
+                null, Boolean.FALSE,
+                new Object(), Boolean.FALSE,
+                i1, Boolean.TRUE,
+                new IdentityStub(i1.getName()), Boolean.TRUE
+        };
+        
+        for (int k=0; k<value.length; k+=2) {
+            assertEquals(value[k+1], new Boolean(i1.equals(value[k])));
+            if (Boolean.TRUE.equals(value[k+1])) assertEquals(i1.hashCode(), value[k].hashCode());
+        }
+        // check other cases
+        Identity i2 = new IdentityStub("testEquals", IdentityScope.getSystemScope());
+        assertEquals(i1.identityEquals(i2), i1.equals(i2));
+        Identity i3 = new IdentityStub("testEquals3");
+        assertEquals(i1.identityEquals(i3), i1.equals(i3));
+        
+    }
+
+    /**
+     * verify Identity.toString() throws Exception is permission is denied
+     */
+    public void testToString1() {
+        MySecurityManager sm = new MySecurityManager();
+        sm.denied.add(new SecurityPermission("printIdentity"));
+        System.setSecurityManager(sm);
+        try {
+            new IdentityStub("testToString").toString();
+            fail("SecurityException should be thrown");
+        } catch (SecurityException ok) {
+        } finally {
+            System.setSecurityManager(null);
+        }          
+    }
+    /**
+     * verify Identity.toString() 
+     */
+    public void testToString2() {    
+        assertNotNull(new IdentityStub("testToString2").toString());
+    }
+
+    /**
+     * verify Identity() creates instance
+     */
+    public void testIdentity() {
+        assertNotNull(new IdentityStub());
+    }
+
+    /*
+     * Cverify Identity(String) creates instance with given name
+     */
+    public void testIdentityString() {
+        Identity i = new IdentityStub("iii");
+        assertNotNull(i);
+        assertEquals("iii", i.getName());
+        i=new IdentityStub(null);
+        assertNotNull(i);
+        assertNull(i.getName());
+    }
+
+    /**
+     * verify Identity(String, IdentityScope) creates instance with given name and in give scope
+     */
+    public void testIdentityStringIdentityScope() throws Exception {
+        IdentityScope s = IdentityScope.getSystemScope();        
+        Identity i = new IdentityStub("iii2", s);
+        assertNotNull(i);
+        assertEquals("iii2", i.getName());
+        assertSame(s, i.getScope());
+        assertSame(i, s.getIdentity(i.getName()));        
+    }
+
+    /**
+     * verify addCertificate(Certificate certificate) adds a certificate for this identity.
+     * If the identity has a public key, the public key in the certificate must be the same
+     *  
+     */
+    public void testAddCertificate1() throws Exception {
+        Identity i = new IdentityStub("iii");
+        PublicKeyStub pk1 = new PublicKeyStub("kkk", "fff", new byte[]{1,2,3,4,5});
+        i.setPublicKey(pk1);
+        // try with the same key
+        CertificateStub c1 = new CertificateStub("fff", null, null, pk1);
+        i.addCertificate(c1);
+        assertSame(c1, i.certificates()[0]);
+        // try Certificate with different key
+        try {
+            i.addCertificate(new CertificateStub("ccc", null, null, new PublicKeyStub("k2", "fff", new byte[]{6,7,8,9,0})));
+            fail("KeyManagementException should be thrown");
+        } catch (KeyManagementException ok) {}        
+    }
+
+    /**
+     * verify addCertificate(Certificate certificate) adds a certificate for this identity.
+     * if the identity does not have a public key, the identity's public key is set to be that specified in the certificate.
+     */
+    public void testAddCertificate2() throws Exception {
+        Identity i = new IdentityStub("iii");
+        PublicKeyStub pk1 = new PublicKeyStub("kkk", "fff", null);        
+        CertificateStub c1 = new CertificateStub("fff", null, null, pk1);
+        i.addCertificate(c1);
+        assertSame(c1, i.certificates()[0]);
+        assertSame(pk1, i.getPublicKey());
+        	
+    }
+    
+    /**
+     * verify addCertificate(Certificate certificate) throws SecurityException is permission is denied
+     */
+    public void testAddCertificate3() throws Exception {
+        MySecurityManager sm = new MySecurityManager();
+        sm.denied.add(new SecurityPermission("addIdentityCertificate"));
+        System.setSecurityManager(sm);
+        try {
+            new IdentityStub("iii").addCertificate(new CertificateStub("ccc", null, null, null));
+            fail("SecurityException should be thrown");
+        } catch (SecurityException ok) {
+        } finally {
+            System.setSecurityManager(null);
+        }        
+    }
+    
+    /**
+     * verify addCertificate(Certificate certificate) throws KeyManagementException if certificate is null
+     */
+    public void testAddCertificate4() throws Exception {
+        try {
+            new IdentityStub("aaa").addCertificate(null);
+            fail("KeyManagementException should be thrown");
+        } catch (KeyManagementException ok) {
+        } catch (NullPointerException ok) {}
+        
+    }
+//
+//  Commented out since there will no be fix for the test failure    
+//    /**
+//     * verify removeCertificate(Certificate certificate) removes cetrificate
+//     */
+//    public void testRemoveCertificate1() throws Exception{
+//        Identity i = new IdentityStub("iii");
+//        PublicKeyStub pk1 = new PublicKeyStub("kkk", "fff", null);        
+//        CertificateStub c1 = new CertificateStub("fff", null, null, pk1);
+//        i.addCertificate(c1);
+//        assertSame(c1, i.certificates()[0]);
+//        i.removeCertificate(c1);
+//        assertEquals(0, i.certificates().length);
+//        // throw KeyManagementException if certificate not found
+//        try {
+//            i.removeCertificate(c1);
+//            fail("KeyManagementException should be thrown");
+//        } catch (KeyManagementException ok) {     
+//        }
+//        try {
+//            i.removeCertificate(null);
+//            fail("KeyManagementException should be thrown");
+//        } catch (KeyManagementException ok) {
+//            
+//        }
+//    }
+    /**
+     * verify removeCertificate(Certificate certificate) throws SecurityException if permission is denied
+     */
+    public void testRemoveCertificate2() throws Exception{
+        MySecurityManager sm = new MySecurityManager();
+        sm.denied.add(new SecurityPermission("removeIdentityCertificate"));
+        Identity i = new IdentityStub("iii");
+        i.addCertificate(new CertificateStub("ccc", null, null, null));
+        System.setSecurityManager(sm);
+        try {
+            i.removeCertificate(i.certificates()[0]);
+            fail("SecurityException should be thrown");
+        } catch (SecurityException ok) {
+        } finally {
+            System.setSecurityManager(null);
+        }
+        
+    }
+
+    /**
+     * verify certificates() returns a copy of all certificates for this identity
+     */
+    public void testCertificates() throws Exception {
+        Identity i = new IdentityStub("iii");
+        PublicKeyStub pk1 = new PublicKeyStub("kkk", "fff", null);        
+        CertificateStub c1 = new CertificateStub("fff", null, null, pk1);
+        CertificateStub c2 = new CertificateStub("zzz", null, null, pk1);
+        i.addCertificate(c1);
+        i.addCertificate(c2);
+        Certificate[] s = i.certificates();
+        assertEquals(2, s.length);
+        assertTrue(c1.equals(s[0]) || c2.equals(s[0]));
+        assertTrue(c1.equals(s[1]) || c2.equals(s[1]));
+        s[0] = null;
+        s[1] = null;
+        // check that the copy was modified
+        s = i.certificates();
+        assertEquals(2, s.length);
+        assertTrue(c1.equals(s[0]) || c2.equals(s[0]));
+        assertTrue(c1.equals(s[1]) || c2.equals(s[1]));
+    }
+
+    /**
+     * verify Identity.identityEquals(Identity) return true, only if names and public keys are equal 
+     */
+    
+    public void testIdentityEquals() throws Exception {
+        String name = "nnn";
+        PublicKey pk = new PublicKeyStub("aaa", "fff", new byte[]{1,2,3,4,5});
+        Identity i = new IdentityStub(name);
+        i.setPublicKey(pk);
+        Object[] value = {
+                //null, Boolean.FALSE,
+                //new Object(), Boolean.FALSE,
+                new IdentityStub("111"), Boolean.FALSE,
+                new IdentityStub(name), Boolean.FALSE,
+                new IdentityStub(name, IdentityScope.getSystemScope()), Boolean.FALSE,
+                i, Boolean.TRUE,
+                new IdentityStub(name, pk), Boolean.TRUE                
+        };
+        for (int k=0; k<value.length; k+=2){
+            assertEquals(value[k+1], new Boolean(i.identityEquals((Identity)value[k])));
+            if (Boolean.TRUE.equals(value[k+1])) assertEquals(i.hashCode(), value[k].hashCode());
+        }
+        Identity i2 = IdentityScope.getSystemScope().getIdentity(name); 
+        i2.setPublicKey(pk);        
+        assertTrue(i.identityEquals(i2));
+    }
+
+    /**
+     * verify Identity.toString(boolean) return string representation of identity
+     */
+    public void testToStringboolean() throws Exception {
+        new IdentityStub("aaa").toString(false);
+        new IdentityStub("aaa2", IdentityScope.getSystemScope()).toString(false);
+        new IdentityStub("bbb").toString(true);
+        new IdentityStub("bbb2", IdentityScope.getSystemScope()).toString(true);
+    }
+
+    /**
+     * verify Identity.getScope() returns identity's scope
+     */    
+    public void testGetScope() throws Exception {
+       Identity i = new IdentityStub("testGetScope");
+       assertNull(i.getScope());
+       IdentityScope s = IdentityScope.getSystemScope();
+       
+       Identity i2 = new IdentityStub("testGetScope2", s);
+       assertSame(s, i2.getScope());
+        
+    }
+    /**
+     * 
+     * verify Identity.setPublicKey() throws SecurityException if permission is denied
+     *
+     */
+    public void testSetPublicKey1() throws Exception {
+        MySecurityManager sm = new MySecurityManager();
+        sm.denied.add(new SecurityPermission("setIdentityPublicKey"));
+        System.setSecurityManager(sm);
+        try {
+            new IdentityStub("testSetPublicKey1").setPublicKey(new PublicKeyStub("kkk", "testSetPublicKey1", null));
+            fail("SecurityException should be thrown");
+        } catch (SecurityException ok) {
+        } finally {
+            System.setSecurityManager(null);
+        }        
+    
+    }
+    /**
+     * 
+     * verify Identity.setPublicKey() throws KeyManagementException if key is invalid 
+     *
+     */
+    public void testSetPublicKey2() throws Exception {
+        Identity i2 = new IdentityStub("testSetPublicKey2_2", IdentityScope.getSystemScope());
+        new PublicKeyStub("kkk", "testSetPublicKey2", new byte[]{1,2,3,4,5});
+        try {
+            i2.setPublicKey(null);
+            //fail("KeyManagementException should be thrown - key is null");            
+        } catch (KeyManagementException ok) {}
+    }
+    
+//
+//  Commented out since there will no be fix for the test failure       
+//    /**
+//     * 
+//     * verify Identity.setPublicKey() throws KeyManagementException if key is already used 
+//     *
+//     */
+//    public void testSetPublicKey3() throws Exception {
+//        Identity i1 = new IdentityStub("testSetPublicKey3_1", IdentityScope.getSystemScope());
+//        Identity i2 = new IdentityStub("testSetPublicKey3_2", IdentityScope.getSystemScope());
+//        PublicKey pk = new PublicKeyStub("kkk", "fff", new byte[]{1,2,3,4,5});
+//        i1.setPublicKey(pk);
+//        try {
+//            i2.setPublicKey(pk);
+//            fail("KeyManagementException should be thrown - key already used");            
+//        } catch (KeyManagementException ok) {};
+//    }
+    /**
+     * 
+     * verify Identity.setPublicKey()  removes old key and all identity's certificates
+     *
+     */
+    public void testSetPublicKey4() throws Exception {
+        Identity i = new IdentityStub("testSetPublicKey4");
+        PublicKeyStub pk1 = new PublicKeyStub("kkk", "Identity.testSetPublicKey4", null);        
+        CertificateStub c1 = new CertificateStub("fff", null, null, pk1);
+        CertificateStub c2 = new CertificateStub("zzz", null, null, pk1);
+        i.addCertificate(c1);
+        i.addCertificate(c2);
+        assertEquals(2, i.certificates().length);
+        assertSame(pk1, i.getPublicKey());
+        
+        PublicKeyStub pk2 = new PublicKeyStub("zzz", "Identity.testSetPublicKey4", null);    
+        i.setPublicKey(pk2);
+        assertSame(pk2, i.getPublicKey());
+        assertEquals(0, i.certificates().length);
+    }
+    
+    /**
+     * verify Identity.getPublicKey() returns public key
+     */
+    
+    public void testGetPublicKey() throws Exception {
+        Identity i = new IdentityStub("testGetPublicKey");
+        assertNull(i.getPublicKey());
+        PublicKey pk = new PublicKeyStub("kkk", "Identity.testGetPublicKey", null);
+        i.setPublicKey(pk);
+        assertSame(pk, i.getPublicKey());        
+    }
+
+    /**
+     * 
+     * verify Identity.setInfo() throws SecurityException if permission is denied
+     *
+     *
+     */
+    public void testSetInfo() throws Exception {
+        MySecurityManager sm = new MySecurityManager();
+        sm.denied.add(new SecurityPermission("setIdentityInfo"));
+        System.setSecurityManager(sm);
+        try {
+            new IdentityStub("testSetInfo").setInfo("some info");
+            fail("SecurityException should be thrown");
+        } catch (SecurityException ok) {
+        } finally {
+            System.setSecurityManager(null);
+        }        
+    }
+
+    public void testGetInfo() {
+        
+        Identity i = new IdentityStub("testGetInfo");
+        i.setInfo("some info");
+        assertEquals("some info", i.getInfo());
+    }
+    
+    public void testGetName() {
+        Identity i = new IdentityStub("testGetName");
+        assertEquals ("testGetName", i.getName());
+    }
+
+}



Mime
View raw message