Package org.opensaml.security.x509.impl
Class X509KeyManagerX509CredentialAdapter
- java.lang.Object
-
- org.opensaml.security.credential.AbstractCredential
-
- org.opensaml.security.x509.impl.X509KeyManagerX509CredentialAdapter
-
- All Implemented Interfaces:
Credential,X509Credential
public class X509KeyManagerX509CredentialAdapter extends AbstractCredential implements X509Credential
A class that wraps aX509KeyManagerand exposes it as anX509Credential.
-
-
Field Summary
Fields Modifier and Type Field Description private StringcredentialAliasAlias used to reference the credential in the key manager.private X509KeyManagerkeyManagerWrapped key manager.
-
Constructor Summary
Constructors Constructor Description X509KeyManagerX509CredentialAdapter(X509KeyManager manager, String alias)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<? extends Credential>getCredentialType()Get the primary type of the credential instance.Collection<X509CRL>getCRLs()Gets a collection of CRLs associated with the credential.X509CertificategetEntityCertificate()Gets the public key certificate for the entity.Collection<X509Certificate>getEntityCertificateChain()Gets an immutable collection of certificates in the entity's trust chain.PrivateKeygetPrivateKey()Gets the private key for the entity if there is one.PublicKeygetPublicKey()Gets the public key for the entity.voidsetEntityId(String newEntityID)Sets the ID of the entity this credential is for.voidsetUsageType(UsageType newUsageType)Sets the usage type for this credential.-
Methods inherited from class org.opensaml.security.credential.AbstractCredential
getCredentialContextSet, getEntityId, getKeyNames, getSecretKey, getUsageType, setPrivateKey, setPublicKey, setSecretKey
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opensaml.security.credential.Credential
getCredentialContextSet, getEntityId, getKeyNames, getSecretKey, getUsageType
-
-
-
-
Field Detail
-
credentialAlias
private final String credentialAlias
Alias used to reference the credential in the key manager.
-
keyManager
private final X509KeyManager keyManager
Wrapped key manager.
-
-
Constructor Detail
-
X509KeyManagerX509CredentialAdapter
public X509KeyManagerX509CredentialAdapter(@Nonnull @ParameterName(name="manager") X509KeyManager manager, @Nonnull @ParameterName(name="alias") String alias)
Constructor.- Parameters:
manager- wrapped key manageralias- alias used to reference the credential in the key manager
-
-
Method Detail
-
getCRLs
@Nullable public Collection<X509CRL> getCRLs()
Gets a collection of CRLs associated with the credential.- Specified by:
getCRLsin interfaceX509Credential- Returns:
- CRLs associated with the credential
-
getEntityCertificate
@Nonnull public X509Certificate getEntityCertificate()
Gets the public key certificate for the entity. The public key of this certificate will be the same key obtained fromCredential.getPublicKey().- Specified by:
getEntityCertificatein interfaceX509Credential- Returns:
- the public key certificate for the entity
-
getEntityCertificateChain
@Nonnull public Collection<X509Certificate> getEntityCertificateChain()
Gets an immutable collection of certificates in the entity's trust chain. The entity certificate is contained within this list. No specific ordering of the certificates is guaranteed.- Specified by:
getEntityCertificateChainin interfaceX509Credential- Returns:
- entities certificate chain
-
getPrivateKey
@Nullable public PrivateKey getPrivateKey()
Gets the private key for the entity if there is one.- Specified by:
getPrivateKeyin interfaceCredential- Overrides:
getPrivateKeyin classAbstractCredential- Returns:
- the private key for the entity
-
getPublicKey
@Nullable public PublicKey getPublicKey()
Gets the public key for the entity.- Specified by:
getPublicKeyin interfaceCredential- Overrides:
getPublicKeyin classAbstractCredential- Returns:
- public key for the entity
-
getCredentialType
@Nonnull public Class<? extends Credential> getCredentialType()
Get the primary type of the credential instance. This will usually be the primary sub-interface ofCredentialimplemented by an implementation.- Specified by:
getCredentialTypein interfaceCredential- Returns:
- the credential type
-
setEntityId
public void setEntityId(@Nullable String newEntityID)Sets the ID of the entity this credential is for.- Overrides:
setEntityIdin classAbstractCredential- Parameters:
newEntityID- ID of the entity this credential is for
-
setUsageType
public void setUsageType(@Nonnull UsageType newUsageType)Sets the usage type for this credential.- Overrides:
setUsageTypein classAbstractCredential- Parameters:
newUsageType- usage type for this credential
-
-