Package org.opensaml.security.credential
Class CredentialSupport
- java.lang.Object
-
- org.opensaml.security.credential.CredentialSupport
-
public final class CredentialSupport extends Object
Helper methods for working withCredential
instances.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
CredentialSupport()
Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Key
extractDecryptionKey(Credential credential)
Extract the decryption key from the credential.static Key
extractEncryptionKey(Credential credential)
Extract the encryption key from the credential.static Key
extractSigningKey(Credential credential)
Extract the signing key from the credential.static Key
extractVerificationKey(Credential credential)
Extract the verification key from the credential.static BasicX509Credential
getSimpleCredential(X509Certificate cert, PrivateKey privateKey)
Get a simple, minimal credential containing an end-entity X.509 certificate, and optionally a private key.static BasicCredential
getSimpleCredential(PublicKey publicKey, PrivateKey privateKey)
Get a simple, minimal credential containing a public key, and optionally a private key.static BasicCredential
getSimpleCredential(SecretKey secretKey)
Get a simple, minimal credential containing a secret (symmetric) key.
-
-
-
Method Detail
-
extractEncryptionKey
@Nullable public static Key extractEncryptionKey(@Nullable Credential credential)
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
@Nullable public static Key extractDecryptionKey(@Nullable Credential credential)
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
@Nullable public static Key extractSigningKey(@Nullable Credential credential)
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
@Nullable public static Key extractVerificationKey(@Nullable Credential credential)
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
@Nonnull public static BasicCredential getSimpleCredential(@Nonnull SecretKey secretKey)
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
-
-