Package org.opensaml.security.credential
Class CredentialSupport
java.lang.Object
org.opensaml.security.credential.CredentialSupport
Helper methods for working with
Credential instances.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyextractDecryptionKey(Credential credential) Extract the decryption key from the credential.static KeyextractEncryptionKey(Credential credential) Extract the encryption key from the credential.static KeyextractSigningKey(Credential credential) Extract the signing key from the credential.static KeyextractVerificationKey(Credential credential) Extract the verification key from the credential.static BasicX509CredentialgetSimpleCredential(X509Certificate cert, PrivateKey privateKey) Get a simple, minimal credential containing an end-entity X.509 certificate, and optionally a private key.static BasicCredentialgetSimpleCredential(PublicKey publicKey, PrivateKey privateKey) Get a simple, minimal credential containing a public key, and optionally a private key.static BasicCredentialgetSimpleCredential(SecretKey secretKey) Get a simple, minimal credential containing a secret (symmetric) key.
-
Constructor Details
-
CredentialSupport
private CredentialSupport()Constructor.
-
-
Method Details
-
extractEncryptionKey
Extract the encryption key from the credential.- Parameters:
credential- the credential containing the encryption key- Returns:
- the encryption key (either a public key or a secret (symmetric) key
-
extractDecryptionKey
Extract the decryption key from the credential.- Parameters:
credential- the credential containing the decryption key- Returns:
- the decryption key (either a private key or a secret (symmetric) key
-
extractSigningKey
Extract the signing key from the credential.- Parameters:
credential- the credential containing the signing key- Returns:
- the signing key (either a private key or a secret (symmetric) key
-
extractVerificationKey
Extract the verification key from the credential.- Parameters:
credential- the credential containing the verification key- Returns:
- the verification key (either a public key or a secret (symmetric) key
-
getSimpleCredential
Get a simple, minimal credential containing a secret (symmetric) key.- Parameters:
secretKey- the symmetric key to wrap- Returns:
- a credential containing the secret key specified
-
getSimpleCredential
@Nonnull public static BasicCredential getSimpleCredential(@Nonnull PublicKey publicKey, @Nullable PrivateKey privateKey) Get a simple, minimal credential containing a public key, and optionally a private key.- Parameters:
publicKey- the public key to wrapprivateKey- the private key to wrap, which may be null- Returns:
- a credential containing the key(s) specified
-
getSimpleCredential
@Nonnull public static BasicX509Credential getSimpleCredential(@Nonnull X509Certificate cert, @Nullable PrivateKey privateKey) Get a simple, minimal credential containing an end-entity X.509 certificate, and optionally a private key.- Parameters:
cert- the end-entity certificate to wrapprivateKey- the private key to wrap, which may be null- Returns:
- a credential containing the certificate and key specified
-