Package org.postgresql.ssl
Class Pk8OrPemKeyManager
java.lang.Object
org.postgresql.ssl.Pk8OrPemKeyManager
- All Implemented Interfaces:
KeyManager,X509KeyManager
A key manager that selects PEM when its header is found within the first 64 KiB
of the key file, and PK8/DER otherwise. This preserves libpq's preference for PEM
before DER, while using a bounded marker scan rather than parsing the key during
format detection.
The delegate is resolved lazily on the first call to any X509KeyManager
method, so this works regardless of which method the TLS engine calls first.
-
Constructor Summary
ConstructorsConstructorDescriptionPk8OrPemKeyManager(String keyFilePath, PEMKeyManager pem, LazyKeyManager pk8) -
Method Summary
Modifier and TypeMethodDescriptionchooseClientAlias(String[] keyType, Principal[] issuers, Socket socket) chooseServerAlias(String keyType, Principal[] issuers, Socket socket) getCertificateChain(String alias) String[]getClientAliases(String keyType, Principal[] issuers) getPrivateKey(String alias) String[]getServerAliases(String keyType, Principal[] issuers) voidPropagates any exception from the resolved delegate key manager, including an insecure-permission error detected while probing the key file.
-
Constructor Details
-
Pk8OrPemKeyManager
-
-
Method Details
-
getClientAliases
- Specified by:
getClientAliasesin interfaceX509KeyManager
-
chooseClientAlias
- Specified by:
chooseClientAliasin interfaceX509KeyManager
-
getServerAliases
- Specified by:
getServerAliasesin interfaceX509KeyManager
-
chooseServerAlias
- Specified by:
chooseServerAliasin interfaceX509KeyManager
-
getCertificateChain
- Specified by:
getCertificateChainin interfaceX509KeyManager
-
getPrivateKey
- Specified by:
getPrivateKeyin interfaceX509KeyManager
-
throwKeyManagerException
Propagates any exception from the resolved delegate key manager, including an insecure-permission error detected while probing the key file.- Throws:
PSQLException- if the delegate key manager has a stored exception
-