mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 11:12:22 -05:00
Fix from audit
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@722 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
6b27c6193a
commit
c3ea20816e
@ -71,7 +71,8 @@ public class DavGatewaySSLProtocolSocketFactory implements SecureProtocolSocketF
|
|||||||
|
|
||||||
private SSLContext sslcontext;
|
private SSLContext sslcontext;
|
||||||
|
|
||||||
private SSLContext createSSLContext() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException, IOException, CertificateException, InvalidAlgorithmParameterException {
|
private SSLContext createSSLContext() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException,
|
||||||
|
InvalidAlgorithmParameterException {
|
||||||
// PKCS11 client certificate settings
|
// PKCS11 client certificate settings
|
||||||
String pkcs11Library = Settings.getProperty("davmail.ssl.pkcs11Library");
|
String pkcs11Library = Settings.getProperty("davmail.ssl.pkcs11Library");
|
||||||
if (pkcs11Library != null && pkcs11Library.length() > 0) {
|
if (pkcs11Library != null && pkcs11Library.length() > 0) {
|
||||||
@ -80,12 +81,12 @@ public class DavGatewaySSLProtocolSocketFactory implements SecureProtocolSocketF
|
|||||||
pkcs11Buffer.append("library=").append(pkcs11Library).append('\n');
|
pkcs11Buffer.append("library=").append(pkcs11Library).append('\n');
|
||||||
String pkcs11Config = Settings.getProperty("davmail.ssl.pkcs11Config");
|
String pkcs11Config = Settings.getProperty("davmail.ssl.pkcs11Config");
|
||||||
if (pkcs11Config != null && pkcs11Config.length() > 0) {
|
if (pkcs11Config != null && pkcs11Config.length() > 0) {
|
||||||
pkcs11Buffer.append(pkcs11Config).append('\n');
|
pkcs11Buffer.append(pkcs11Config).append('\n');
|
||||||
}
|
}
|
||||||
Provider p = new SunPKCS11(new ByteArrayInputStream(pkcs11Buffer.toString().getBytes()));
|
Provider p = new SunPKCS11(new ByteArrayInputStream(pkcs11Buffer.toString().getBytes()));
|
||||||
Security.addProvider(p);
|
Security.addProvider(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(/*KeyManagerFactory.getDefaultAlgorithm()*/"NewSunX509");
|
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(/*KeyManagerFactory.getDefaultAlgorithm()*/"NewSunX509");
|
||||||
KeyStore.Builder scBuilder = KeyStore.Builder.newInstance("PKCS11", null,
|
KeyStore.Builder scBuilder = KeyStore.Builder.newInstance("PKCS11", null,
|
||||||
new KeyStore.CallbackHandlerProtection(new CallbackHandler() {
|
new KeyStore.CallbackHandlerProtection(new CallbackHandler() {
|
||||||
|
Loading…
Reference in New Issue
Block a user