public class X509CertificateChainBuilder extends Object
Constructor and Description |
---|
X509CertificateChainBuilder() |
Modifier and Type | Method and Description |
---|---|
static X509Certificate[] |
buildPath(X509Certificate startingPoint,
Certificate[] certificates)
Builds the ordered certificate chain upwards from the startingPoint.
|
static X509Certificate[] |
buildPath(X509Certificate startingPoint,
Collection certificates)
Builds the ordered certificate chain upwards from the startingPoint.
|
static boolean |
isSelfSigned(X509Certificate cert) |
static void |
main(String[] args) |
static boolean |
verify(X509Certificate cert,
PublicKey key) |
public X509CertificateChainBuilder()
public static X509Certificate[] buildPath(X509Certificate startingPoint, Certificate[] certificates) throws NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, CertificateException
Thanks to Joe Whitney for helping me put together a Big-O( m * n ) implementation where m = the length of the final certificate chain. For a while I was using a Big-O( n ^ 2 ) implementation!
startingPoint
- the X509Certificate for which we want to find
ancestorscertificates
- A pool of certificates in which we expect to find
the startingPoint's ancestors.NoSuchAlgorithmException
- on unsupported signature
algorithms.InvalidKeyException
- on incorrect key.NoSuchProviderException
- if there's no default provider.CertificateException
- on encoding errors.public static X509Certificate[] buildPath(X509Certificate startingPoint, Collection certificates) throws NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, CertificateException
Thanks to Joe Whitney for helping me put together a Big-O( m * n ) implementation where m = the length of the final certificate chain. For a while I was using a Big-O( n ^ 2 ) implementation!
startingPoint
- the X509Certificate for which we want to find
ancestorscertificates
- A pool of certificates in which we expect to find
the startingPoint's ancestors.NoSuchAlgorithmException
- on unsupported signature
algorithms.InvalidKeyException
- on incorrect key.NoSuchProviderException
- if there's no default provider.CertificateException
- on encoding errors.public static boolean isSelfSigned(X509Certificate cert) throws CertificateException, InvalidKeyException, NoSuchAlgorithmException, NoSuchProviderException
public static boolean verify(X509Certificate cert, PublicKey key) throws CertificateException, InvalidKeyException, NoSuchAlgorithmException, NoSuchProviderException