Package org.postgresql.ssl
Class PKCS12KeyManager
- java.lang.Object
-
- org.postgresql.ssl.PKCS12KeyManager
-
- All Implemented Interfaces:
javax.net.ssl.KeyManager
,javax.net.ssl.X509KeyManager
public class PKCS12KeyManager extends java.lang.Object implements javax.net.ssl.X509KeyManager
-
-
Field Summary
Fields Modifier and Type Field Description private javax.security.auth.callback.CallbackHandler
cbh
private PSQLException
error
private java.lang.String
keyfile
private java.security.KeyStore
keyStore
(package private) boolean
keystoreLoaded
-
Constructor Summary
Constructors Constructor Description PKCS12KeyManager(java.lang.String pkcsFile, javax.security.auth.callback.CallbackHandler cbh)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
chooseClientAlias(java.lang.String[] keyType, java.security.Principal[] principals, java.net.Socket socket)
java.lang.String
chooseServerAlias(java.lang.String s, java.security.Principal[] principals, java.net.Socket socket)
java.security.cert.X509Certificate[]
getCertificateChain(java.lang.String alias)
java.lang.String[]
getClientAliases(java.lang.String keyType, java.security.Principal[] principals)
java.security.PrivateKey
getPrivateKey(java.lang.String s)
java.lang.String[]
getServerAliases(java.lang.String s, java.security.Principal[] principals)
private void
loadKeyStore()
void
throwKeyManagerException()
getCertificateChain and getPrivateKey cannot throw exceptions, therefore any exception is stored inerror
and can be raised by this method.
-
-
-
Field Detail
-
cbh
private final javax.security.auth.callback.CallbackHandler cbh
-
error
private PSQLException error
-
keyfile
private final java.lang.String keyfile
-
keyStore
private final java.security.KeyStore keyStore
-
keystoreLoaded
boolean keystoreLoaded
-
-
Constructor Detail
-
PKCS12KeyManager
public PKCS12KeyManager(java.lang.String pkcsFile, javax.security.auth.callback.CallbackHandler cbh) throws PSQLException
- Throws:
PSQLException
-
-
Method Detail
-
throwKeyManagerException
public void throwKeyManagerException() throws PSQLException
getCertificateChain and getPrivateKey cannot throw exceptions, therefore any exception is stored inerror
and can be raised by this method.- Throws:
PSQLException
- if any exception is stored inerror
and can be raised
-
getClientAliases
public java.lang.String[] getClientAliases(java.lang.String keyType, java.security.Principal[] principals)
- Specified by:
getClientAliases
in interfacejavax.net.ssl.X509KeyManager
-
chooseClientAlias
public java.lang.String chooseClientAlias(java.lang.String[] keyType, java.security.Principal[] principals, java.net.Socket socket)
- Specified by:
chooseClientAlias
in interfacejavax.net.ssl.X509KeyManager
-
getServerAliases
public java.lang.String[] getServerAliases(java.lang.String s, java.security.Principal[] principals)
- Specified by:
getServerAliases
in interfacejavax.net.ssl.X509KeyManager
-
chooseServerAlias
public java.lang.String chooseServerAlias(java.lang.String s, java.security.Principal[] principals, java.net.Socket socket)
- Specified by:
chooseServerAlias
in interfacejavax.net.ssl.X509KeyManager
-
getCertificateChain
public java.security.cert.X509Certificate[] getCertificateChain(java.lang.String alias)
- Specified by:
getCertificateChain
in interfacejavax.net.ssl.X509KeyManager
-
getPrivateKey
public java.security.PrivateKey getPrivateKey(java.lang.String s)
- Specified by:
getPrivateKey
in interfacejavax.net.ssl.X509KeyManager
-
loadKeyStore
private void loadKeyStore() throws java.lang.Exception
- Throws:
java.lang.Exception
-
-