Author: coheigea
Date: Wed Jun 17 14:11:20 2009
New Revision: 785613
URL: http://svn.apache.org/viewvc?rev=785613&view=rev
Log:
Fixed a bug with using BouncyCastle to parse pkcs12 files
- getCertificateAlias seems to return the wrong alias, so commenting this part
out.
Modified:
webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/components/crypto/CryptoBase.java
webservices/wss4j/branches/1_5_x-fixes/test/wssec/TestWSSecurityWSS178.java
Modified:
webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/components/crypto/CryptoBase.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/components/crypto/CryptoBase.java?rev=785613&r1=785612&r2=785613&view=diff
==============================================================================
---
webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/components/crypto/CryptoBase.java
(original)
+++
webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/components/crypto/CryptoBase.java
Wed Jun 17 14:11:20 2009
@@ -415,14 +415,20 @@
*/
public String getAliasForX509Cert(Certificate cert) throws
WSSecurityException {
try {
- String alias = keystore.getCertificateAlias(cert);
- if (alias != null) {
- return alias;
+ if (keystore == null) {
+ return null;
}
- // Use brute force search
+ //
+ // The following code produces the wrong alias in BouncyCastle and
so
+ // we'll just use the brute-force search
+ //
+ // String alias = keystore.getCertificateAlias(cert);
+ // if (alias != null) {
+ // return alias;
+ // }
Enumeration e = keystore.aliases();
while (e.hasMoreElements()) {
- alias = (String) e.nextElement();
+ String alias = (String) e.nextElement();
X509Certificate cert2 = (X509Certificate)
keystore.getCertificate(alias);
if (cert2.equals(cert)) {
return alias;
Modified:
webservices/wss4j/branches/1_5_x-fixes/test/wssec/TestWSSecurityWSS178.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/branches/1_5_x-fixes/test/wssec/TestWSSecurityWSS178.java?rev=785613&r1=785612&r2=785613&view=diff
==============================================================================
--- webservices/wss4j/branches/1_5_x-fixes/test/wssec/TestWSSecurityWSS178.java
(original)
+++ webservices/wss4j/branches/1_5_x-fixes/test/wssec/TestWSSecurityWSS178.java
Wed Jun 17 14:11:20 2009
@@ -73,7 +73,7 @@
+ "</SOAP-ENV:Envelope>";
private WSSecurityEngine secEngine = new WSSecurityEngine();
- private Crypto crypto = CryptoFactory.getInstance("crypto.properties");
+ private Crypto crypto;
private MessageContext msgContext;
private Message message;
@@ -84,6 +84,8 @@
*/
public TestWSSecurityWSS178(String name) {
super(name);
+ secEngine.getWssConfig(); //make sure BC gets registered
+ crypto = CryptoFactory.getInstance("crypto.properties");
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]