Package net.dona.doip.util.tls
Class AutoSelfSignedKeyManager
java.lang.Object
javax.net.ssl.X509ExtendedKeyManager
net.dona.doip.util.tls.AutoSelfSignedKeyManager
- All Implemented Interfaces:
KeyManager
,X509KeyManager
This object is used to provide a private key for authentication to the other side
of a secure socket connection.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a key manager for the supplied identity with a newly minted keypair.AutoSelfSignedKeyManager
(String id, X509Certificate[] chain, PrivateKey privKey) Constructs a key manager corresponding to the supplied certificate chain and private key.AutoSelfSignedKeyManager
(String id, X509Certificate cert, PrivateKey privKey) Constructs a key manager corresponding to the supplied certificate and private key.AutoSelfSignedKeyManager
(String id, PublicKey pubKey, PrivateKey privKey) Constructs a key manager corresponding the the supplied keypair. -
Method Summary
Modifier and TypeMethodDescriptionchooseClientAlias
(String[] keyTypes, Principal[] issuers, Socket socket) chooseEngineClientAlias
(String[] as, Principal[] aprincipal, SSLEngine sslengine) chooseEngineServerAlias
(String s, Principal[] aprincipal, SSLEngine sslengine) chooseServerAlias
(String keyType, Principal[] issuers, Socket socket) Returns the certificate (supplied or generated).getCertificateChain
(String alias) String[]
getClientAliases
(String keyType, Principal[] issuers) getPrivateKey
(String alias) String[]
getServerAliases
(String keyType, Principal[] issuers)
-
Constructor Details
-
AutoSelfSignedKeyManager
Constructs a key manager corresponding to the supplied certificate chain and private key.- Parameters:
id
- the identifier of the entitychain
- the certificate chain of the entityprivKey
- the private key of the entity
-
AutoSelfSignedKeyManager
Constructs a key manager corresponding to the supplied certificate and private key.- Parameters:
id
- the identifier of the entitycert
- the certificate of the entityprivKey
- the private key of the entity
-
AutoSelfSignedKeyManager
Constructs a key manager corresponding the the supplied keypair. A self-signed certificate will be generated with the appropriate id.- Parameters:
id
- the identifier of the entitypubKey
- the public key of the entityprivKey
- the private key of the entity
-
AutoSelfSignedKeyManager
Constructs a key manager for the supplied identity with a newly minted keypair.- Parameters:
id
- the identifier of the entity- Throws:
Exception
- if there is any issue minting a keypair
-
-
Method Details
-
getCertificate
Returns the certificate (supplied or generated).- Returns:
- the certificate
-
chooseClientAlias
-
chooseServerAlias
-
getServerAliases
-
getCertificateChain
-
getClientAliases
-
getPrivateKey
-
chooseEngineClientAlias
- Overrides:
chooseEngineClientAlias
in classX509ExtendedKeyManager
-
chooseEngineServerAlias
- Overrides:
chooseEngineServerAlias
in classX509ExtendedKeyManager
-