Class KeyStoreCertificateBucket
- java.lang.Object
-
- network.oxalis.commons.certvalidator.util.KeyStoreCertificateBucket
-
- All Implemented Interfaces:
Iterable<X509Certificate>,CertificateBucket
public class KeyStoreCertificateBucket extends Object implements CertificateBucket
Reads a keystore from input stream and keeps it in memory.
-
-
Constructor Summary
Constructors Constructor Description KeyStoreCertificateBucket(InputStream inputStream, String password)KeyStoreCertificateBucket(String type, InputStream inputStream, String password)KeyStoreCertificateBucket(KeyStore keyStore)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description X509CertificatefindBySubject(X500Principal principal)Find certificate by subject.protected KeyStoregetKeyStore()Allows for overriding method of fetching key store when used.Iterator<X509Certificate>iterator()SimpleCertificateBucketstartsWith(String... prefix)Create a new SimpleCertificateBucket and adding certificates based on prefix(es).voidstartsWith(SimpleCertificateBucket certificates, String... prefix)Adding certificates identified by prefix(es) from key store to a SimpleCertificateBucket.SimpleCertificateBuckettoSimple(String... aliases)Create a new SimpleCertificateBucket and adding certificates based on aliases.voidtoSimple(SimpleCertificateBucket certificates, String... aliases)Adding certificates identified by aliases from key store to a SimpleCertificateBucket.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface network.oxalis.commons.certvalidator.api.CertificateBucket
asList
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
keyStore
protected KeyStore keyStore
-
-
Constructor Detail
-
KeyStoreCertificateBucket
public KeyStoreCertificateBucket(KeyStore keyStore)
-
KeyStoreCertificateBucket
public KeyStoreCertificateBucket(InputStream inputStream, String password) throws CertificateBucketException
- Throws:
CertificateBucketException
-
KeyStoreCertificateBucket
public KeyStoreCertificateBucket(String type, InputStream inputStream, String password) throws CertificateBucketException
- Throws:
CertificateBucketException
-
-
Method Detail
-
findBySubject
public X509Certificate findBySubject(X500Principal principal) throws CertificateBucketException
Find certificate by subject.- Specified by:
findBySubjectin interfaceCertificateBucket- Parameters:
principal- Principal representing certificate to be found.- Returns:
- Certificate if found, otherwise null.
- Throws:
CertificateBucketException
-
iterator
public Iterator<X509Certificate> iterator()
- Specified by:
iteratorin interfaceIterable<X509Certificate>
-
toSimple
public void toSimple(SimpleCertificateBucket certificates, String... aliases) throws CertificateBucketException
Adding certificates identified by aliases from key store to a SimpleCertificateBucket.- Throws:
CertificateBucketException
-
toSimple
public SimpleCertificateBucket toSimple(String... aliases) throws CertificateBucketException
Create a new SimpleCertificateBucket and adding certificates based on aliases.- Throws:
CertificateBucketException
-
startsWith
public void startsWith(SimpleCertificateBucket certificates, String... prefix) throws CertificateBucketException
Adding certificates identified by prefix(es) from key store to a SimpleCertificateBucket.- Throws:
CertificateBucketException
-
startsWith
public SimpleCertificateBucket startsWith(String... prefix) throws CertificateBucketException
Create a new SimpleCertificateBucket and adding certificates based on prefix(es).- Throws:
CertificateBucketException
-
getKeyStore
protected KeyStore getKeyStore() throws CertificateBucketException
Allows for overriding method of fetching key store when used.- Throws:
CertificateBucketException
-
-