mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-23 06:42:05 +01:00
Fixed a problem where not fully setting up PKI results in
failed logins. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@9543 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
1b5203d24e
commit
e51e9432f2
1 changed files with 15 additions and 5 deletions
|
@ -1303,7 +1303,7 @@ public class XMPPConnection {
|
|||
*/
|
||||
void proceedTLSReceived() throws Exception {
|
||||
SSLContext context = SSLContext.getInstance("TLS");
|
||||
KeyStore ks;
|
||||
KeyStore ks = null;
|
||||
KeyManager[] kms = null;
|
||||
PasswordCallback pcb = null;
|
||||
|
||||
|
@ -1311,7 +1311,11 @@ public class XMPPConnection {
|
|||
ks = null;
|
||||
} else {
|
||||
System.out.println("Keystore type: "+configuration.getKeystoreType());
|
||||
if(configuration.getKeystoreType().equals("PKCS11")) {
|
||||
if(configuration.getKeystoreType().equals("NONE")) {
|
||||
ks = null;
|
||||
pcb = null;
|
||||
}
|
||||
else if(configuration.getKeystoreType().equals("PKCS11")) {
|
||||
Provider p = new sun.security.pkcs11.SunPKCS11(configuration.getPKCSConfig());
|
||||
Security.addProvider(p);
|
||||
ks = KeyStore.getInstance("PKCS11",p);
|
||||
|
@ -1327,9 +1331,15 @@ public class XMPPConnection {
|
|||
}
|
||||
else {
|
||||
ks = KeyStore.getInstance(configuration.getKeystoreType());
|
||||
try {
|
||||
ks.load(new FileInputStream(configuration.getKeystorePath()), pcb.getPassword());
|
||||
pcb = new PasswordCallback("Keystore Password: ",false);
|
||||
callbackHandler.handle(new Callback[]{pcb});
|
||||
ks.load(new FileInputStream(configuration.getKeystorePath()), pcb.getPassword());
|
||||
}
|
||||
catch(Exception e) {
|
||||
ks = null;
|
||||
pcb = null;
|
||||
}
|
||||
}
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue