Package net.dona.doip.util.tls
Class TrustManagerForSpecifiedServerIdAndKeys
- java.lang.Object
-
- net.dona.doip.util.tls.TrustManagerForSpecifiedServerIdAndKeys
-
- All Implemented Interfaces:
javax.net.ssl.TrustManager
,javax.net.ssl.X509TrustManager
public class TrustManagerForSpecifiedServerIdAndKeys extends java.lang.Object implements javax.net.ssl.X509TrustManager
A trust manager which expects the server certificate to both have the specified identitifier, and to have one of a list of specified public keys.
-
-
Constructor Summary
Constructors Constructor Description TrustManagerForSpecifiedServerIdAndKeys(java.lang.String id, java.util.List<java.security.PublicKey> keys)
Constructs a trust manager which expects the server certificate to both have the specified identitifier, and to have one of a list of specified public keys.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkClientTrusted(java.security.cert.X509Certificate[] chain, java.lang.String authType)
void
checkServerTrusted(java.security.cert.X509Certificate[] chain, java.lang.String authType)
java.security.cert.X509Certificate[]
getAcceptedIssuers()
-
-
-
Constructor Detail
-
TrustManagerForSpecifiedServerIdAndKeys
public TrustManagerForSpecifiedServerIdAndKeys(java.lang.String id, java.util.List<java.security.PublicKey> keys)
Constructs a trust manager which expects the server certificate to both have the specified identitifier, and to have one of a list of specified public keys.- Parameters:
id
- the expected server identifierkeys
- the list of permissible server public keys
-
-
Method Detail
-
getAcceptedIssuers
public java.security.cert.X509Certificate[] getAcceptedIssuers()
- Specified by:
getAcceptedIssuers
in interfacejavax.net.ssl.X509TrustManager
-
checkClientTrusted
public void checkClientTrusted(java.security.cert.X509Certificate[] chain, java.lang.String authType) throws java.security.cert.CertificateException
- Specified by:
checkClientTrusted
in interfacejavax.net.ssl.X509TrustManager
- Throws:
java.security.cert.CertificateException
-
checkServerTrusted
public void checkServerTrusted(java.security.cert.X509Certificate[] chain, java.lang.String authType) throws java.security.cert.CertificateException
- Specified by:
checkServerTrusted
in interfacejavax.net.ssl.X509TrustManager
- Throws:
java.security.cert.CertificateException
-
-