public final class TrustStore extends Object
The truststore JKS resource to be used is defined by the 'cert.truststore.jks' EDOC configuration property.
public void addJreCaCerts()
throws KeyStoreException
KeyStoreExceptionpublic void addTrustedCertificates(String... territory)
public static TrustStore getInstance() throws KeyStoreException
KeyStoreExceptionpublic static TrustStore getInstance(boolean useTrustedList) throws KeyStoreException
KeyStoreExceptionpublic static TrustStore getInstance(KeyStore keyStore) throws KeyStoreException
KeyStoreExceptionpublic static TrustStore getInstance(KeyStore keyStore, boolean useTrustedList) throws KeyStoreException
KeyStoreExceptionpublic boolean useTrustedList()
public KeyStore getKeyStore() throws KeyStoreException
KeyStoreException@Deprecated public static X509Certificate findTrustedCert(String subject, BigInteger serial) throws KeyStoreException
The subject name must be specified using the grammar defined in RFC 1779 or RFC 2253 (either format is acceptable),
e.g. "CN=VAS Latvijas Pasts SI(CA1), OU=Sertifikacijas pakalpojumi, O=VAS Latvijas Pasts - Vien.reg.Nr.40003052790, C=LV".
subject - an X.500 distinguished name in RFC 1779 or RFC 2253 format.serial - certificate serial number.KeyStoreException - if trusted certificate cannot be found.@Deprecated public static X509Certificate findTrustedCert(String subject, String subjectKeyIdentifier) throws KeyStoreException
The subject name must be specified using the grammar defined in RFC 1779 or RFC 2253 (either format is acceptable),
e.g. "CN=VAS Latvijas Pasts SI(CA1), OU=Sertifikacijas pakalpojumi, O=VAS Latvijas Pasts - Vien.reg.Nr.40003052790, C=LV".
The subject key identifier must be specified as hexadecimal string of the
DER encoded value (excluding tag and length) of the subject public key field in the certificate,
e.g. "2c3e036e9239e283072795b10feffe633a6a9017".
subject - an X.500 distinguished name in RFC 1779 or RFC 2253 format.subjectKeyIdentifier - hexadecimal string of the subject public key field.KeyStoreException - if trusted certificate cannot be found.public X509Certificate findTrustedCertificate(String subject, String subjectKeyIdentifier) throws KeyStoreException
KeyStoreException@Deprecated public static X509Certificate findCertCA(X509Certificate cert) throws KeyStoreException
cert - the certificate.KeyStoreException - if CA certificate cannot be found.public X509Certificate findCertificateCA(X509Certificate cert) throws KeyStoreException
KeyStoreException@Deprecated public static X509Certificate findCertRootCA(X509Certificate cert) throws KeyStoreException
cert - the certificate.KeyStoreException - if ROOT CA certificate cannot be found.public X509Certificate findCertificateRootCA(X509Certificate cert) throws KeyStoreException
KeyStoreException@Deprecated public static CertPath generateCertPath(X509Certificate cert) throws KeyStoreException, CertificateException
cert - the certificate.KeyStoreException - if CA certificates cannot be found.CertificateException - if certification path cannot be generated.@Deprecated public static CertPath generateCertPath(X509Certificate cert, boolean addTrustAnchor) throws KeyStoreException, CertificateException
cert - the certificate.addTrustAnchor - to also add the trust anchor certificate to chain.KeyStoreException - if CA certificates cannot be found.CertificateException - if certification path cannot be generated.public CertPath generateCertificatePath(X509Certificate cert, boolean addTrustAnchor) throws KeyStoreException, CertificateException
public CertPath generateCertificatePath(X509Certificate cert, boolean addTrustAnchor, boolean useCache) throws KeyStoreException, CertificateException
public static Set<TrustAnchor> findTrustAnchors(X509Certificate cert) throws KeyStoreException
cert - the certificate.KeyStoreException - if TrustAnchors cannot be found.public Set<TrustAnchor> findTrustAnchors(CertPath certPath) throws KeyStoreException
KeyStoreExceptionpublic TrustAnchor findTrustAnchor(List<X509Certificate> certPath) throws KeyStoreException
KeyStoreExceptionpublic static boolean isCertIssuedByCA(X509Certificate cert, X509Certificate ca)
cert - the certificate.ca - the CA certificate.public static boolean isRootCert(X509Certificate cert)
cert - the certificate.@Deprecated public static boolean isTrustedCert(X509Certificate cert) throws KeyStoreException
cert - the certificate.KeyStoreException - if truststore cannot be loaded.public boolean isTrustedCertificate(X509Certificate cert) throws KeyStoreException
KeyStoreExceptionpublic TrustedCertificate getTrustedCertificate(X509Certificate cert)
@Deprecated public static boolean isTrustedRootCert(X509Certificate cert) throws KeyStoreException
cert - the certificate.KeyStoreException - if truststore cannot be loaded.public boolean isTrustedRootCertificate(X509Certificate cert) throws KeyStoreException
KeyStoreExceptionpublic static boolean isAccreditedRoot(X509Certificate cert) throws KeyStoreException
cert - the certificate.KeyStoreException - if truststore cannot be loaded.public X509Certificate findTrustedCertificate(String subject, BigInteger serial) throws KeyStoreException
KeyStoreException@Deprecated public static KeyStore getTrustStore() throws KeyStoreException
KeyStoreException - if truststore cannot be loaded.public static KeyStore loadStore(String resource, String type, char[] password) throws Exception
Exceptionpublic static boolean isTestingEnvironment(X509Certificate cert)
public static KeyStore loadStore(List<X509Certificate> list) throws KeyStoreException
KeyStoreException