You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by gi...@apache.org on 2012/11/07 17:22:32 UTC

svn commit: r1406701 - /santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/AbstractInboundSecurityToken.java

Author: giger
Date: Wed Nov  7 16:22:32 2012
New Revision: 1406701

URL: http://svn.apache.org/viewvc?rev=1406701&view=rev
Log:
correct key-type (sym, asym) determination

Modified:
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/AbstractInboundSecurityToken.java

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/AbstractInboundSecurityToken.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/AbstractInboundSecurityToken.java?rev=1406701&r1=1406700&r2=1406701&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/AbstractInboundSecurityToken.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/AbstractInboundSecurityToken.java Wed Nov  7 16:22:32 2012
@@ -56,6 +56,7 @@ public abstract class AbstractInboundSec
     private final Map<String, Key> keyTable = new Hashtable<String, Key>();
     private PublicKey publicKey;
     private X509Certificate[] x509Certificates;
+    private boolean asymmetric = false;
 
     public AbstractInboundSecurityToken(SecurityContext securityContext, String id,
                                         XMLSecurityConstants.KeyIdentifierType keyIdentifierType) {
@@ -104,10 +105,7 @@ public abstract class AbstractInboundSec
 
     @Override
     public boolean isAsymmetric() throws XMLSecurityException {
-        if (getSecretKey() instanceof PrivateKey || getPublicKey() != null) {
-            return true;
-        }
-        return false;
+        return asymmetric;
     }
 
     public void setSecretKey(String algorithmURI, Key key) {
@@ -117,6 +115,9 @@ public abstract class AbstractInboundSec
         if (key != null) {
             this.keyTable.put(algorithmURI, key);
         }
+        if (key instanceof PrivateKey) {
+            this.asymmetric = true;
+        }
     }
 
     @Override
@@ -169,6 +170,7 @@ public abstract class AbstractInboundSec
 
     public void setPublicKey(PublicKey publicKey) {
         this.publicKey = publicKey;
+        this.asymmetric = true;
     }
 
     @Override