You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by di...@apache.org on 2004/03/11 09:31:26 UTC

cvs commit: ws-fx/wss4j/src/org/apache/ws/security/components/crypto Merlin.java

dims        2004/03/11 00:31:26

  Modified:    wss4j/src/org/apache/ws/security/components/crypto
                        Merlin.java
  Log:
  brute force search for the cert alias....our scenario 2 test still fails
  
  Revision  Changes    Path
  1.6       +13 -1     ws-fx/wss4j/src/org/apache/ws/security/components/crypto/Merlin.java
  
  Index: Merlin.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/wss4j/src/org/apache/ws/security/components/crypto/Merlin.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Merlin.java	10 Mar 2004 14:23:34 -0000	1.5
  +++ Merlin.java	11 Mar 2004 08:31:26 -0000	1.6
  @@ -336,7 +336,19 @@
        * See comment above
        */
       public String getAliasForX509Cert(Certificate cert) throws Exception {
  -        return keystore.getCertificateAlias(cert);
  +        String alias = keystore.getCertificateAlias(cert);
  +        if(alias != null)
  +            return alias;
  +        // Use brute force search
  +        Enumeration e = keystore.aliases();
  +        while(e.hasMoreElements()) {
  +            alias = (String)e.nextElement();
  +            X509Certificate cert2 = (X509Certificate) keystore.getCertificate(alias);
  +            if(cert2.equals(cert)) {
  +                return alias;
  +            }
  +        }        
  +        return null;
       }
   
       /**