Author: coheigea
Date: Tue Feb 22 12:14:56 2011
New Revision: 1073308

URL: http://svn.apache.org/viewvc?rev=1073308&view=rev
Log:
First update of the Crypto interface to make it more generic.

Added:
    
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/Merlin.java
      - copied, changed from r1072924, 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/AbstractCrypto.java
Removed:
    
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/AbstractCrypto.java
Modified:
    
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSSecurityEngine.java
    
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/Crypto.java
    
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/CryptoBase.java
    
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/SAMLUtil.java
    
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/SignatureTrustValidator.java
    
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/components/crypto/CryptoProviderTest.java
    
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/components/crypto/CryptoTest.java
    
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/SignaturePartsTest.java
    
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlNegativeTest.java
    
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlReferenceTest.java
    
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SignedSamlTokenHOKTest.java

Modified: 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSSecurityEngine.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSSecurityEngine.java?rev=1073308&r1=1073307&r2=1073308&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSSecurityEngine.java
 (original)
+++ 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSSecurityEngine.java
 Tue Feb 22 12:14:56 2011
@@ -272,7 +272,7 @@ public class WSSecurityEngine {
      *         was performed.
      * @throws WSSecurityException
      */
-    protected List<WSSecurityEngineResult> processSecurityHeader(
+    public List<WSSecurityEngineResult> processSecurityHeader(
         Element securityHeader,
         CallbackHandler cb,
         Crypto sigCrypto,

Modified: 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/Crypto.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/Crypto.java?rev=1073308&r1=1073307&r2=1073308&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/Crypto.java
 (original)
+++ 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/Crypto.java
 Tue Feb 22 12:14:56 2011
@@ -26,8 +26,8 @@ import java.security.KeyStore;
 import java.security.PrivateKey;
 import java.security.PublicKey;
 import java.security.cert.Certificate;
-import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
+import java.util.List;
 
 public interface Crypto {
     
@@ -95,22 +95,6 @@ public interface Crypto {
      */
     public void setTrustStore(KeyStore trustStore);
     
-    /**
-     * Gets the CertificateFactory instantiated by the underlying 
implementation
-     *
-     * @return the CertificateFactory
-     * @throws WSSecurityException
-     */
-    public CertificateFactory getCertificateFactory() throws 
WSSecurityException;
-    
-    /**
-     * Sets the CertificateFactory instance on this Crypto instance
-     *
-     * @param provider the CertificateFactory provider name
-     * @param the CertificateFactory the CertificateFactory instance to set
-     */
-    public void setCertificateFactory(String provider, CertificateFactory 
certFactory);
-    
     //
     // Crypto functionality methods
     //
@@ -147,6 +131,16 @@ public interface Crypto {
         throws WSSecurityException;
 
     /**
+     * Lookup X509 Certificates in the keystore according to a given DN of the 
subject of the certificate
+     * <p/>
+     *
+     * @param subjectDN The DN of subject to look for in the keystore
+     * @return An array with all certificates with the same DN as given in the 
parameters
+     * @throws WSSecurityException
+     */
+    public List<Certificate[]> getCertificatesForDN(String subjectDN) throws 
WSSecurityException;
+    
+    /**
      * Get a byte array given an array of X509 certificates.
      * <p/>
      *
@@ -168,14 +162,6 @@ public interface Crypto {
     public PrivateKey getPrivateKey(String alias, String password) throws 
Exception;
     
     /**
-     * Check to see if the certificate argument is in the keystore
-     * @param cert The certificate to check
-     * @return true if cert is in the keystore
-     * @throws WSSecurityException
-     */
-    public boolean isCertificateInKeyStore(X509Certificate cert) throws 
WSSecurityException;
-
-    /**
      * get the list of certificates for a given alias. This method
      * reads a new certificate chain and overwrites a previously
      * stored certificate chain.
@@ -186,7 +172,7 @@ public interface Crypto {
      *         null if this alias does not exist in the keystore
      */
     public X509Certificate[] getCertificates(String alias) throws 
WSSecurityException;
-
+    
     /**
      * Return a X509 Certificate alias in the keystore according to a given 
Certificate
      * <p/>
@@ -274,13 +260,4 @@ public interface Crypto {
      */
     public boolean verifyTrust(PublicKey publicKey) throws WSSecurityException;
 
-    /**
-     * Lookup X509 Certificates in the keystore according to a given DN of the 
subject of the certificate
-     * <p/>
-     *
-     * @param subjectDN The DN of subject to look for in the keystore
-     * @return An array with all alias of certificates with the same DN as 
given in the parameters
-     * @throws WSSecurityException
-     */
-    public String[] getAliasesForDN(String subjectDN) throws 
WSSecurityException;
 }

Modified: 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/CryptoBase.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/CryptoBase.java?rev=1073308&r1=1073307&r2=1073308&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/CryptoBase.java
 (original)
+++ 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/CryptoBase.java
 Tue Feb 22 12:14:56 2011
@@ -57,13 +57,6 @@ import java.util.Map;
 import java.util.Set;
 import javax.security.auth.x500.X500Principal;
 
-/**
- * Created by IntelliJ IDEA.
- * User: dims
- * Date: Sep 15, 2005
- * Time: 9:50:40 AM
- * To change this template use File | Settings | File Templates.
- */
 public abstract class CryptoBase implements Crypto {
     public static final String SKI_OID = "2.5.29.14";
     /**
@@ -192,7 +185,7 @@ public abstract class CryptoBase impleme
      * @param provider the CertificateFactory provider name
      * @param the CertificateFactory the CertificateFactory instance to set
      */
-    public void setCertificateFactory(String provider, CertificateFactory 
certFactory) {
+    protected void setCertificateFactory(String provider, CertificateFactory 
certFactory) {
         if (provider == null || provider.length() == 0) {
             certFactMap.put(certFactory.getProvider().getName(), certFactory);
         } else {
@@ -209,7 +202,7 @@ public abstract class CryptoBase impleme
      * @throws org.apache.ws.security.WSSecurityException
      *
      */
-    public CertificateFactory getCertificateFactory() throws 
WSSecurityException {
+    protected CertificateFactory getCertificateFactory() throws 
WSSecurityException {
         String provider = getCryptoProvider();
         String keyStoreProvider = null;
         if (keystore != null) {
@@ -355,7 +348,7 @@ public abstract class CryptoBase impleme
         return vr;
     }
     
-    private Object createBCX509Name(String s) {
+    protected Object createBCX509Name(String s) {
         if (BC_509CLASS_CONS != null) {
              try {
                  return BC_509CLASS_CONS.newInstance(new Object[] {s});
@@ -499,41 +492,6 @@ public abstract class CryptoBase impleme
         return null;
     }
     
-    
-    /**
-     * Check to see if the certificate argument is in the keystore
-     * @param cert The certificate to check
-     * @return true if cert is in the keystore
-     * @throws WSSecurityException
-     */
-    public boolean isCertificateInKeyStore(X509Certificate cert) throws 
WSSecurityException {
-        String issuerString = cert.getIssuerX500Principal().getName();
-        BigInteger issuerSerial = cert.getSerialNumber();
-        
-        X509Certificate foundCert = getX509Certificate(issuerString, 
issuerSerial);
-
-        //
-        // If a certificate has been found, the certificates must be compared
-        // to ensure against phony DNs (compare encoded form including 
signature)
-        //
-        if (foundCert != null && foundCert.equals(cert)) {
-            if (log.isDebugEnabled()) {
-                log.debug(
-                    "Direct trust for certificate with " + 
cert.getSubjectX500Principal().getName()
-                );
-            }
-            return true;
-        }
-        if (log.isDebugEnabled()) {
-            log.debug(
-                "No alias found for subject from issuer with " + issuerString 
-                + " (serial " + issuerSerial + ")"
-            );
-        }
-        return false;
-    }
-    
-
     /**
      * Lookup a X509 Certificate in the keystore according to a given
      * SubjectKeyIdentifier.
@@ -786,18 +744,17 @@ public abstract class CryptoBase impleme
     }
 
     /**
-     * Lookup X509 Certificates in the keystore according to a given DN of the 
subject of the 
+     * Lookup Certificate (chains) in the keystore according to a given DN of 
the subject of the 
      * certificate
      * <p/>
      * The search gets all alias names of the keystore and gets the 
certificate (chain)
      * for each alias. Then the DN of the certificate is compared with the 
parameters.
      *
      * @param subjectDN The DN of subject to look for in the keystore
-     * @return Array with all alias of certificates with the same DN as given 
in the parameters
+     * @return Array with all certificate (chains) with the same DN as given 
in the parameters
      * @throws org.apache.ws.security.WSSecurityException
-     *
      */
-    public String[] getAliasesForDN(String subjectDN) throws 
WSSecurityException {
+    public List<Certificate[]> getCertificatesForDN(String subjectDN) throws 
WSSecurityException {
 
         //
         // Convert the subject DN to a java X500Principal object first. This 
is to ensure
@@ -814,23 +771,17 @@ public abstract class CryptoBase impleme
         } catch (java.lang.IllegalArgumentException ex) {
             subject = createBCX509Name(subjectDN);
         }
-        List<String> aliases = null;
+        List<Certificate[]> certList = null;
         if (keystore != null) {
-            aliases = getAliases(subject, keystore);
+            certList = getCertificates(subject, keystore);
         }
 
         //If we can't find the issuer in the keystore then look at the 
truststore
-        if ((aliases == null || aliases.size() == 0) && truststore != null) {
-            aliases = getAliases(subject, truststore);
+        if ((certList == null || certList.size() == 0) && truststore != null) {
+            certList = getCertificates(subject, truststore);
         }
         
-        // Convert the vector into an array
-        String[] result = new String[aliases.size()];
-        for (int i = 0; i < aliases.size(); i++) {
-            result[i] = (String) aliases.get(i);
-        }
-
-        return result;
+        return certList;
     }
     
     /**
@@ -1060,22 +1011,21 @@ public abstract class CryptoBase impleme
     }
     
     /**
-     * Get all of the aliases of the X500Principal argument in the supplied 
KeyStore
+     * Get a List of Certificate (chains) of the X500Principal argument in the 
supplied KeyStore 
      * @param subjectRDN either an X500Principal or a BouncyCastle X509Name 
instance.
      * @param store The KeyStore
-     * @return A list of aliases
+     * @return A list of Certificate (chains)
      * @throws WSSecurityException
      */
-    private List<String> getAliases(Object subjectRDN, KeyStore store) 
+    private List<Certificate[]> getCertificates(Object subjectRDN, KeyStore 
store) 
         throws WSSecurityException {
-        // Store the aliases found
-        List<String> aliases = new ArrayList<String>();
-        Certificate cert = null;
+        // Store the certs found
+        List<Certificate[]> certList = new ArrayList<Certificate[]>();
         
         try {
             for (Enumeration<String> e = store.aliases(); 
e.hasMoreElements();) {
                 String alias = e.nextElement();
-
+                Certificate cert = null;
                 Certificate[] certs = store.getCertificateChain(alias);
                 if (certs == null || certs.length == 0) {
                     // no cert chain, so lets check if getCertificate gives us 
a  result.
@@ -1092,7 +1042,11 @@ public abstract class CryptoBase impleme
                     Object certName = createBCX509Name(foundRDN.getName());
 
                     if (subjectRDN.equals(certName)) {
-                        aliases.add(alias);
+                        if (certs == null) {
+                            certList.add(new Certificate[]{cert});
+                        } else {
+                            certList.add(certs);
+                        }
                     }
                 }
             }
@@ -1101,6 +1055,6 @@ public abstract class CryptoBase impleme
                 WSSecurityException.FAILURE, "keystore", null, e
             );
         }
-        return aliases;
+        return certList;
     }
 }

Copied: 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/Merlin.java
 (from r1072924, 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/AbstractCrypto.java)
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/Merlin.java?p2=webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/Merlin.java&p1=webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/AbstractCrypto.java&r1=1072924&r2=1073308&rev=1073308&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/AbstractCrypto.java
 (original)
+++ 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/components/crypto/Merlin.java
 Tue Feb 22 12:14:56 2011
@@ -31,7 +31,7 @@ import java.security.KeyStore;
 import java.security.cert.CertificateFactory;
 import java.util.Properties;
 
-public abstract class AbstractCrypto extends CryptoBase {
+public class Merlin extends CryptoBase {
     
     /*
      * Deprecated types
@@ -73,29 +73,29 @@ public abstract class AbstractCrypto ext
     public static final String TRUSTSTORE_TYPE =
         "org.apache.ws.security.crypto.merlin.truststore.type";
     
-    private static final Log log = 
LogFactory.getLog(AbstractCrypto.class.getName());
+    private static final Log log = LogFactory.getLog(Merlin.class.getName());
     private static final boolean doDebug = log.isDebugEnabled();
 
     protected static CertificateFactory certFact;
     protected Properties properties = null;
     
-    public AbstractCrypto() {
+    public Merlin() {
         // default constructor
     }
     
-    public AbstractCrypto(Properties properties) 
+    public Merlin(Properties properties) 
         throws CredentialException, IOException {
-        this(properties, Loader.getClassLoader(AbstractCrypto.class));
+        this(properties, Loader.getClassLoader(Merlin.class));
     }
 
-    public AbstractCrypto(Properties properties, ClassLoader loader) 
+    public Merlin(Properties properties, ClassLoader loader) 
         throws CredentialException, IOException {
         loadProperties(properties, loader);
     }
     
     public void loadProperties(Properties properties) 
         throws CredentialException, IOException {
-        loadProperties(properties, 
Loader.getClassLoader(AbstractCrypto.class));
+        loadProperties(properties, Loader.getClassLoader(Merlin.class));
     }
     
     public void loadProperties(Properties properties, ClassLoader loader) 
@@ -279,6 +279,7 @@ public abstract class AbstractCrypto ext
         return ks;
     }
 
+    @Override
     public String
     getCryptoProvider() {
         if (cryptoProvider != null) {
@@ -307,6 +308,7 @@ public abstract class AbstractCrypto ext
      *
      * @return alias name of the default X509 certificate
      */
+    @Override
     public String getDefaultX509Alias() {
         if (defaultAlias != null) {
             return defaultAlias;

Modified: 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/SAMLUtil.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/SAMLUtil.java?rev=1073308&r1=1073307&r2=1073308&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/SAMLUtil.java 
(original)
+++ 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/SAMLUtil.java 
Tue Feb 22 12:14:56 2011
@@ -164,12 +164,6 @@ public class SAMLUtil {
             return new SAMLKeyInfo(key);
         }
         
-        if (crypto == null) {
-            throw new WSSecurityException(
-                WSSecurityException.FAILURE, "noSigCryptoFile"
-            );
-        }
-        
         for (org.opensaml.saml1.core.Statement stmt : 
assertion.getStatements()) {
             org.opensaml.saml1.core.Subject samlSubject = null;
             if (stmt instanceof org.opensaml.saml1.core.AttributeStatement) {
@@ -319,6 +313,11 @@ public class SAMLUtil {
                             certs[0] = (X509Certificate)x509obj;
                             return new SAMLKeyInfo(certs);
                         } else if (x509obj instanceof X509IssuerSerial) {
+                            if (crypto == null) {
+                                throw new WSSecurityException(
+                                    WSSecurityException.FAILURE, 
"noSigCryptoFile"
+                                );
+                            }
                             String alias = 
                                 crypto.getAliasForX509Cert(
                                     
((X509IssuerSerial)x509obj).getIssuerName(), 

Modified: 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/SignatureTrustValidator.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/SignatureTrustValidator.java?rev=1073308&r1=1073307&r2=1073308&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/SignatureTrustValidator.java
 (original)
+++ 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/SignatureTrustValidator.java
 Tue Feb 22 12:14:56 2011
@@ -21,9 +21,11 @@ package org.apache.ws.security.validate;
 
 import java.math.BigInteger;
 import java.security.PublicKey;
+import java.security.cert.Certificate;
 import java.security.cert.CertificateExpiredException;
 import java.security.cert.CertificateNotYetValidException;
 import java.security.cert.X509Certificate;
+import java.util.List;
 
 import javax.security.auth.callback.CallbackHandler;
 
@@ -162,7 +164,7 @@ public class SignatureTrustValidator imp
         //
         // FIRST step - Search the keystore for the transmitted certificate
         //
-        if (crypto.isCertificateInKeyStore(cert)) {
+        if (isCertificateInKeyStore(crypto, cert)) {
             return true;
         }
 
@@ -170,14 +172,14 @@ public class SignatureTrustValidator imp
         // SECOND step - Search for the issuer of the transmitted certificate 
in the 
         // keystore or the truststore
         //
-        String[] aliases = crypto.getAliasesForDN(issuerString);
+        List<Certificate[]> foundCerts = 
crypto.getCertificatesForDN(issuerString);
 
-        // If the alias has not been found, the issuer is not in the 
keystore/truststore
+        // If the certs have not been found, the issuer is not in the 
keystore/truststore
         // As a direct result, do not trust the transmitted certificate
-        if (aliases == null || aliases.length < 1) {
+        if (foundCerts == null || foundCerts.size() < 1) {
             if (LOG.isDebugEnabled()) {
                 LOG.debug(
-                    "No aliases found in keystore for issuer " + issuerString 
+                    "No certs found in keystore for issuer " + issuerString 
                     + " of certificate for " + subjectString
                 );
             }
@@ -186,38 +188,23 @@ public class SignatureTrustValidator imp
 
         //
         // THIRD step
-        // Check the certificate trust path for every alias of the issuer 
found in the 
+        // Check the certificate trust path for every cert of the issuer found 
in the 
         // keystore/truststore
         //
-        for (int i = 0; i < aliases.length; i++) {
-            String alias = aliases[i];
-
-            if (LOG.isDebugEnabled()) {
-                LOG.debug(
-                    "Preparing to validate certificate path with alias " + 
alias 
-                    + " for issuer " + issuerString
-                );
-            }
-
-            // Retrieve the certificate(s) for the alias from the 
keystore/truststore
-            X509Certificate[] certs = crypto.getCertificates(alias);
-
-            // If no certificates have been found, there has to be an error:
-            // The keystore/truststore can find an alias but no certificate(s)
-            if (certs == null || certs.length < 1) {
-                throw new WSSecurityException(
-                    "Could not get certificates for alias " + alias
-                );
-            }
-
+        if (LOG.isDebugEnabled()) {
+            LOG.debug(
+                "Preparing to validate certificate path for issuer " + 
issuerString
+            );
+        }
+        for (Certificate[] foundCertChain : foundCerts) {
             //
             // Form a certificate chain from the transmitted certificate
             // and the certificate(s) of the issuer from the 
keystore/truststore
             //
-            X509Certificate[] x509certs = new X509Certificate[certs.length + 
1];
+            X509Certificate[] x509certs = new 
X509Certificate[foundCertChain.length + 1];
             x509certs[0] = cert;
-            for (int j = 0; j < certs.length; j++) {
-                x509certs[j + 1] = certs[j];
+            for (int j = 0; j < foundCertChain.length; j++) {
+                x509certs[j + 1] = (X509Certificate)foundCertChain[j];
             }
 
             //
@@ -245,6 +232,43 @@ public class SignatureTrustValidator imp
     }
     
     /**
+     * Check to see if the certificate argument is in the keystore
+     * @param crypto The Crypto instance to use
+     * @param cert The certificate to check
+     * @return true if cert is in the keystore
+     * @throws WSSecurityException
+     */
+    private boolean isCertificateInKeyStore(
+        Crypto crypto,
+        X509Certificate cert
+    ) throws WSSecurityException {
+        String issuerString = cert.getIssuerX500Principal().getName();
+        BigInteger issuerSerial = cert.getSerialNumber();
+        
+        X509Certificate foundCert = crypto.getX509Certificate(issuerString, 
issuerSerial);
+
+        //
+        // If a certificate has been found, the certificates must be compared
+        // to ensure against phony DNs (compare encoded form including 
signature)
+        //
+        if (foundCert != null && foundCert.equals(cert)) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug(
+                    "Direct trust for certificate with " + 
cert.getSubjectX500Principal().getName()
+                );
+            }
+            return true;
+        }
+        if (LOG.isDebugEnabled()) {
+            LOG.debug(
+                "No certificate found for subject from issuer with " + 
issuerString 
+                + " (serial " + issuerSerial + ")"
+            );
+        }
+        return false;
+    }
+    
+    /**
      * Evaluate whether the given certificate chain should be trusted.
      * 
      * @param certificates the certificate chain that should be validated 
against the keystore

Modified: 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/components/crypto/CryptoProviderTest.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/components/crypto/CryptoProviderTest.java?rev=1073308&r1=1073307&r2=1073308&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/components/crypto/CryptoProviderTest.java
 (original)
+++ 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/components/crypto/CryptoProviderTest.java
 Tue Feb 22 12:14:56 2011
@@ -59,20 +59,6 @@ public class CryptoProviderTest extends 
     }
 
     /**
-     * A unit test...
-     */
-    @org.junit.Test
-    public void testGetAliasWithReversedDN() throws Exception {
-        String issuer = 
"C=DE,ST=Bayern,L=Munich,O=Apache,OU=WSS4J,CN=Werner,[email protected]";
-        
-        String alias = crypto.getAliasForX509Cert(issuer, new 
java.math.BigInteger("1237819491"));
-        assertNotNull("Alias not found using a reversed DN", alias);
-        
-        String[] aliases = crypto.getAliasesForDN(issuer);
-        assertNotNull("Alias not found using a reversed DN", aliases[0]);
-    }
-    
-    /**
      * Test signing a SOAP message using a cert with an OID
      */
     @org.junit.Test

Modified: 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/components/crypto/CryptoTest.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/components/crypto/CryptoTest.java?rev=1073308&r1=1073307&r2=1073308&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/components/crypto/CryptoTest.java
 (original)
+++ 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/components/crypto/CryptoTest.java
 Tue Feb 22 12:14:56 2011
@@ -41,7 +41,7 @@ public class CryptoTest extends org.juni
     }
 
     @org.junit.Test
-    public void testAbstractCryptoWithNullProperties() 
+    public void testMerlinWithNullProperties() 
         throws Exception {
         Crypto crypto = new NullPropertiesCrypto();
         assertTrue(crypto != null);
@@ -64,7 +64,7 @@ public class CryptoTest extends org.juni
     }
     
     /**
-     * Test for WSS-149 - "AbstractCrypto requires 
org.apache.ws.security.crypto.merlin.file
+     * Test for WSS-149 - "Merlin requires 
org.apache.ws.security.crypto.merlin.file
      * to be set and point to an existing file"
      */
     @org.junit.Test
@@ -92,7 +92,7 @@ public class CryptoTest extends org.juni
         Crypto crypto = new Merlin();
         KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
         ClassLoader loader = Loader.getClassLoader(CryptoTest.class);
-        InputStream input = AbstractCrypto.loadInputStream(loader, 
"keys/wss40.jks");
+        InputStream input = Merlin.loadInputStream(loader, "keys/wss40.jks");
         keyStore.load(input, "security".toCharArray());
         crypto.setKeyStore(keyStore);
         Document signedDoc = builder.build(doc, crypto, secHeader);
@@ -100,7 +100,7 @@ public class CryptoTest extends org.juni
         // Load the truststore
         Crypto processCrypto = new Merlin();
         KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
-        input = AbstractCrypto.loadInputStream(loader, "keys/wss40CA.jks");
+        input = Merlin.loadInputStream(loader, "keys/wss40CA.jks");
         trustStore.load(input, "security".toCharArray());
         processCrypto.setTrustStore(trustStore);
         
@@ -110,7 +110,7 @@ public class CryptoTest extends org.juni
         // Load a (bad) truststore
         processCrypto = new Merlin();
         trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
-        input = AbstractCrypto.loadInputStream(loader, "keys/wss40badca.jks");
+        input = Merlin.loadInputStream(loader, "keys/wss40badca.jks");
         trustStore.load(input, "security".toCharArray());
         processCrypto.setTrustStore(trustStore);
         
@@ -123,10 +123,10 @@ public class CryptoTest extends org.juni
     }
     
     /**
-     * WSS-102 -- ensure AbstractCrypto will null properties
+     * WSS-102 -- ensure Merlin will null properties
      * can be instantiated
      */
-    private static class NullPropertiesCrypto extends AbstractCrypto {
+    private static class NullPropertiesCrypto extends Merlin {
         public NullPropertiesCrypto() 
             throws Exception {
             super((java.util.Properties) null);

Modified: 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/SignaturePartsTest.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/SignaturePartsTest.java?rev=1073308&r1=1073307&r2=1073308&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/SignaturePartsTest.java
 (original)
+++ 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/SignaturePartsTest.java
 Tue Feb 22 12:14:56 2011
@@ -30,7 +30,6 @@ import org.apache.ws.security.WSSecurity
 import org.apache.ws.security.WSSecurityException;
 import org.apache.ws.security.common.SAML1CallbackHandler;
 import org.apache.ws.security.common.SOAPUtil;
-import org.apache.ws.security.components.crypto.AbstractCrypto;
 import org.apache.ws.security.components.crypto.Crypto;
 import org.apache.ws.security.components.crypto.CryptoFactory;
 import org.apache.ws.security.components.crypto.Merlin;
@@ -165,7 +164,7 @@ public class SignaturePartsTest extends 
         Crypto issuerCrypto = new Merlin();
         KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
         ClassLoader loader = 
Loader.getClassLoader(SignedSamlTokenHOKTest.class);
-        InputStream input = AbstractCrypto.loadInputStream(loader, 
"keys/wss40_server.jks");
+        InputStream input = Merlin.loadInputStream(loader, 
"keys/wss40_server.jks");
         keyStore.load(input, "security".toCharArray());
         issuerCrypto.setKeyStore(keyStore);
         
@@ -212,7 +211,7 @@ public class SignaturePartsTest extends 
         // Construct trust crypto instance
         Crypto trustCrypto = new Merlin();
         KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
-        input = AbstractCrypto.loadInputStream(loader, "keys/wss40CA.jks");
+        input = Merlin.loadInputStream(loader, "keys/wss40CA.jks");
         trustStore.load(input, "security".toCharArray());
         trustCrypto.setTrustStore(trustStore);
         

Modified: 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlNegativeTest.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlNegativeTest.java?rev=1073308&r1=1073307&r2=1073308&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlNegativeTest.java
 (original)
+++ 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlNegativeTest.java
 Tue Feb 22 12:14:56 2011
@@ -32,7 +32,6 @@ import org.apache.ws.security.common.Key
 import org.apache.ws.security.common.SAML1CallbackHandler;
 import org.apache.ws.security.common.SAML2CallbackHandler;
 import org.apache.ws.security.common.SOAPUtil;
-import org.apache.ws.security.components.crypto.AbstractCrypto;
 import org.apache.ws.security.components.crypto.Crypto;
 import org.apache.ws.security.components.crypto.CryptoFactory;
 import org.apache.ws.security.components.crypto.Merlin;
@@ -75,14 +74,14 @@ public class SamlNegativeTest extends or
         issuerCrypto = new Merlin();
         KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
         ClassLoader loader = Loader.getClassLoader(SamlNegativeTest.class);
-        InputStream input = AbstractCrypto.loadInputStream(loader, 
"keys/wss40_server.jks");
+        InputStream input = Merlin.loadInputStream(loader, 
"keys/wss40_server.jks");
         keyStore.load(input, "security".toCharArray());
         issuerCrypto.setKeyStore(keyStore);
         
         // Load the server truststore
         trustCrypto = new Merlin();
         KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
-        input = AbstractCrypto.loadInputStream(loader, "keys/wss40CA.jks");
+        input = Merlin.loadInputStream(loader, "keys/wss40CA.jks");
         trustStore.load(input, "security".toCharArray());
         trustCrypto.setTrustStore(trustStore);
     }

Modified: 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlReferenceTest.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlReferenceTest.java?rev=1073308&r1=1073307&r2=1073308&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlReferenceTest.java
 (original)
+++ 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlReferenceTest.java
 Tue Feb 22 12:14:56 2011
@@ -30,7 +30,6 @@ import org.apache.ws.security.common.Key
 import org.apache.ws.security.common.SAML1CallbackHandler;
 import org.apache.ws.security.common.SAML2CallbackHandler;
 import org.apache.ws.security.common.SOAPUtil;
-import org.apache.ws.security.components.crypto.AbstractCrypto;
 import org.apache.ws.security.components.crypto.Crypto;
 import org.apache.ws.security.components.crypto.CryptoFactory;
 import org.apache.ws.security.components.crypto.Merlin;
@@ -72,14 +71,14 @@ public class SamlReferenceTest extends o
         issuerCrypto = new Merlin();
         KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
         ClassLoader loader = 
Loader.getClassLoader(SignedSamlTokenHOKTest.class);
-        InputStream input = AbstractCrypto.loadInputStream(loader, 
"keys/wss40_server.jks");
+        InputStream input = Merlin.loadInputStream(loader, 
"keys/wss40_server.jks");
         keyStore.load(input, "security".toCharArray());
         issuerCrypto.setKeyStore(keyStore);
         
         // Load the server truststore
         trustCrypto = new Merlin();
         KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
-        input = AbstractCrypto.loadInputStream(loader, "keys/wss40CA.jks");
+        input = Merlin.loadInputStream(loader, "keys/wss40CA.jks");
         trustStore.load(input, "security".toCharArray());
         trustCrypto.setTrustStore(trustStore);
     }

Modified: 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SignedSamlTokenHOKTest.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SignedSamlTokenHOKTest.java?rev=1073308&r1=1073307&r2=1073308&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SignedSamlTokenHOKTest.java
 (original)
+++ 
webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SignedSamlTokenHOKTest.java
 Tue Feb 22 12:14:56 2011
@@ -31,7 +31,6 @@ import org.apache.ws.security.common.Key
 import org.apache.ws.security.common.SAML1CallbackHandler;
 import org.apache.ws.security.common.SAML2CallbackHandler;
 import org.apache.ws.security.common.SOAPUtil;
-import org.apache.ws.security.components.crypto.AbstractCrypto;
 import org.apache.ws.security.components.crypto.Crypto;
 import org.apache.ws.security.components.crypto.CryptoFactory;
 import org.apache.ws.security.components.crypto.Merlin;
@@ -68,14 +67,14 @@ public class SignedSamlTokenHOKTest exte
         issuerCrypto = new Merlin();
         KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
         ClassLoader loader = 
Loader.getClassLoader(SignedSamlTokenHOKTest.class);
-        InputStream input = AbstractCrypto.loadInputStream(loader, 
"keys/wss40_server.jks");
+        InputStream input = Merlin.loadInputStream(loader, 
"keys/wss40_server.jks");
         keyStore.load(input, "security".toCharArray());
         issuerCrypto.setKeyStore(keyStore);
         
         // Load the server truststore
         trustCrypto = new Merlin();
         KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
-        input = AbstractCrypto.loadInputStream(loader, "keys/wss40CA.jks");
+        input = Merlin.loadInputStream(loader, "keys/wss40CA.jks");
         trustStore.load(input, "security".toCharArray());
         trustCrypto.setTrustStore(trustStore);
     }


Reply via email to