Package org.wildfly.security.credential
Class X509CertificateChainPrivateCredential
- java.lang.Object
-
- org.wildfly.security.credential.X509CertificateChainPrivateCredential
-
- All Implemented Interfaces:
Cloneable
,AlgorithmCredential
,Credential
,X509CertificateChainCredential
public final class X509CertificateChainPrivateCredential extends Object
A credential containing a private key and an X.509 certificate chain.- Author:
- David M. Lloyd
-
-
Field Summary
-
Fields inherited from interface org.wildfly.security.credential.Credential
NO_CREDENTIALS
-
-
Constructor Summary
Constructors Constructor Description X509CertificateChainPrivateCredential(PrivateKey privateKey, X509Certificate... certificateChain)
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canVerify(Class<? extends Evidence> evidenceClass, String algorithmName)
Determine whether this credential can, generally speaking, verify the given evidence type.X509CertificateChainPrivateCredential
clone()
Creates and returns a copy of thisCredential
.boolean
equals(Object obj)
String
getAlgorithm()
Get the algorithm name associated with this credential (will never benull
).X509Certificate[]
getCertificateChain()
Get a copy of the certificate chain.X509Certificate
getFirstCertificate()
Get the first certificate in the chain.X509Certificate
getLastCertificate()
Get the last certificate in the chain.<P extends AlgorithmParameterSpec>
PgetParameters(Class<P> paramSpecClass)
Get the algorithm parameters of the given type from this credential.PrivateKey
getPrivateKey()
Get the private key.int
hashCode()
boolean
impliesSameParameters(AlgorithmCredential other)
Determine whether the other credential's parameters are implied by this one.boolean
supportsParameters(Class<? extends AlgorithmParameterSpec> paramSpecClass)
Determine whether this credential instance supports the given algorithm parameter type.boolean
verify(Supplier<Provider[]> providerSupplier, Evidence evidence)
Verify the given evidence.boolean
verify(Evidence evidence)
Verify the given evidence.-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.wildfly.security.credential.AlgorithmCredential
getParameters, impliesParameters, matches, matches, matches, supportsParameters
-
Methods inherited from interface org.wildfly.security.credential.Credential
canVerify, castAndApply, castAndApply, castAndApply, castAs, castAs, castAs
-
-
-
-
Constructor Detail
-
X509CertificateChainPrivateCredential
public X509CertificateChainPrivateCredential(PrivateKey privateKey, X509Certificate... certificateChain)
Construct a new instance.- Parameters:
privateKey
- the private key (notnull
)certificateChain
- the certificate chain (notnull
, cannot containnull
elements)
-
-
Method Detail
-
getPrivateKey
public PrivateKey getPrivateKey()
Get the private key.- Returns:
- the private key
-
clone
public X509CertificateChainPrivateCredential clone()
Description copied from interface:X509CertificateChainCredential
Creates and returns a copy of thisCredential
.- Specified by:
clone
in interfaceAlgorithmCredential
- Specified by:
clone
in interfaceCredential
- Specified by:
clone
in interfaceX509CertificateChainCredential
- Returns:
- a copy of this
Credential
.
-
canVerify
public boolean canVerify(Class<? extends Evidence> evidenceClass, String algorithmName)
Description copied from interface:Credential
Determine whether this credential can, generally speaking, verify the given evidence type.- Specified by:
canVerify
in interfaceCredential
- Parameters:
evidenceClass
- the evidence type (must not benull
)algorithmName
- the evidence algorithm name (may benull
if the type of evidence does not support algorithm names)- Returns:
true
if the evidence can be verified by this credential,false
otherwise
-
verify
public boolean verify(Evidence evidence)
Description copied from interface:Credential
Verify the given evidence.- Specified by:
verify
in interfaceCredential
- Parameters:
evidence
- the evidence to verify (must not benull
)- Returns:
true
if the evidence is verified,false
otherwise
-
verify
public boolean verify(Supplier<Provider[]> providerSupplier, Evidence evidence)
Description copied from interface:Credential
Verify the given evidence.- Specified by:
verify
in interfaceCredential
- Parameters:
providerSupplier
- the provider supplier to use for verification purposesevidence
- the evidence to verify (must not benull
)- Returns:
true
if the evidence is verified,false
otherwise
-
getAlgorithm
public String getAlgorithm()
Description copied from interface:AlgorithmCredential
Get the algorithm name associated with this credential (will never benull
).- Specified by:
getAlgorithm
in interfaceAlgorithmCredential
- Returns:
- the algorithm name
-
supportsParameters
public boolean supportsParameters(Class<? extends AlgorithmParameterSpec> paramSpecClass)
Description copied from interface:AlgorithmCredential
Determine whether this credential instance supports the given algorithm parameter type.- Specified by:
supportsParameters
in interfaceAlgorithmCredential
- Parameters:
paramSpecClass
- the parameter specification class (must not benull
)- Returns:
true
if the parameter type is supported,false
otherwise
-
getParameters
public <P extends AlgorithmParameterSpec> P getParameters(Class<P> paramSpecClass)
Description copied from interface:AlgorithmCredential
Get the algorithm parameters of the given type from this credential.- Specified by:
getParameters
in interfaceAlgorithmCredential
- Parameters:
paramSpecClass
- the parameter specification class (must not benull
)- Returns:
- the parameter specification, or
null
if no parameters are present or available or the given type was not supported by this credential
-
impliesSameParameters
public boolean impliesSameParameters(AlgorithmCredential other)
Description copied from interface:AlgorithmCredential
Determine whether the other credential's parameters are implied by this one.- Specified by:
impliesSameParameters
in interfaceAlgorithmCredential
- Parameters:
other
- the other credential (must not benull
)- Returns:
true
if the credentials have matching parameters,false
otherwise
-
getCertificateChain
public X509Certificate[] getCertificateChain()
Description copied from interface:X509CertificateChainCredential
Get a copy of the certificate chain.- Specified by:
getCertificateChain
in interfaceX509CertificateChainCredential
- Returns:
- a copy of the certificate chain
-
getFirstCertificate
public X509Certificate getFirstCertificate()
Description copied from interface:X509CertificateChainCredential
Get the first certificate in the chain. This corresponds to the subject certificate.- Specified by:
getFirstCertificate
in interfaceX509CertificateChainCredential
- Returns:
- the first certificate (not
null
)
-
getLastCertificate
public X509Certificate getLastCertificate()
Description copied from interface:X509CertificateChainCredential
Get the last certificate in the chain. This corresponds to the ultimate issuer certificate.- Specified by:
getLastCertificate
in interfaceX509CertificateChainCredential
- Returns:
- the last certificate (not
null
)
-
-