[wsas-java-dev] svn commit r1168 -
trunk/wsas/java/modules/core/src/org/wso2/wsas/security
svn at wso2.org
svn at wso2.org
Wed Mar 7 13:33:40 PST 2007
Author: azeez
Date: Wed Mar 7 13:33:34 2007
New Revision: 1168
Modified:
trunk/wsas/java/modules/core/src/org/wso2/wsas/security/ServerCrypto.java
Log:
Null check for key provider
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/security/ServerCrypto.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/security/ServerCrypto.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/security/ServerCrypto.java Wed Mar 7 13:33:34 2007
@@ -129,9 +129,8 @@
cert = (X509Certificate) getCertificateFactory()
.generateCertificate(in);
} catch (CertificateException e) {
- throw new WSSecurityException(
- WSSecurityException.SECURITY_TOKEN_UNAVAILABLE,
- "parseError");
+ throw new WSSecurityException(WSSecurityException.SECURITY_TOKEN_UNAVAILABLE,
+ "parseError");
}
return cert;
}
@@ -147,9 +146,8 @@
try {
path = getCertificateFactory().generateCertPath(in);
} catch (CertificateException e) {
- throw new WSSecurityException(
- WSSecurityException.SECURITY_TOKEN_UNAVAILABLE,
- "parseError");
+ throw new WSSecurityException(WSSecurityException.SECURITY_TOKEN_UNAVAILABLE,
+ "parseError");
}
List l = path.getCertificates();
X509Certificate[] certs = new X509Certificate[l.size()];
@@ -179,13 +177,11 @@
CertPath path = getCertificateFactory().generateCertPath(list);
return path.getEncoded();
} catch (CertificateEncodingException e) {
- throw new WSSecurityException(
- WSSecurityException.SECURITY_TOKEN_UNAVAILABLE,
- "encodeError");
+ throw new WSSecurityException(WSSecurityException.SECURITY_TOKEN_UNAVAILABLE,
+ "encodeError");
} catch (CertificateException e) {
- throw new WSSecurityException(
- WSSecurityException.SECURITY_TOKEN_UNAVAILABLE,
- "parseError");
+ throw new WSSecurityException(WSSecurityException.SECURITY_TOKEN_UNAVAILABLE,
+ "parseError");
}
}
@@ -406,10 +402,10 @@
try {
sha = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException ex) {
- throw new WSSecurityException(
- 1,
- "noSKIHandling",
- new Object[]{"Wrong certificate version (<3) and no SHA1 message digest availabe"});
+ throw new WSSecurityException(1,
+ "noSKIHandling",
+ new Object[]{"Wrong certificate version (<3) and no " +
+ "SHA1 message digest availabe"});
}
sha.reset();
sha.update(value);
@@ -568,8 +564,8 @@
return result;
}
- private KeyStore findKeyStore(String ksId, ClassLoader loader)
- throws CredentialException, IOException {
+ private KeyStore findKeyStore(String ksId, ClassLoader loader) throws CredentialException,
+ IOException {
String location = this.getKeyStoreLocation(ksId);
InputStream is = null;
@@ -622,7 +618,14 @@
}
try {
KeyStore tempStore;
- String provider = properties.getProperty(this.getKeyStoreProvider(ksId));
+
+ String provider = null;
+ String keyStoreProvider = this.getKeyStoreProvider(ksId);
+
+ if (keyStoreProvider != null) {
+ provider = properties.getProperty(keyStoreProvider);
+ }
+
if (provider == null || provider.trim().length() == 0) {
tempStore = KeyStore.getInstance(properties.getProperty(this
.getKeyStoreLocation(ksId), KeyStore.getDefaultType()));
More information about the Wsas-java-dev
mailing list