Class SamlCredential
java.lang.Object
com.revetsec.saml.SamlCredential
An RSA private key paired with its public X.509 certificate for SAML signing or decryption.
The application owns key storage and rotation; Revetsec retains no mutable key provider state.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull SamlCredentialLoads an RSA key pair from an application-owned KeyStore.static @NonNull SamlCredentialLoads an unencrypted PKCS#8 or PKCS#1 RSA private key and one X.509 certificate from separate PEM blocks.static @NonNull SamlCredentialfromPrivateKeyAndCertificate(@NonNull PrivateKey key, @NonNull X509Certificate certificate) Pairs an RSA private key with a matching RSA certificate.Returns the certificate for SP metadata.toString()Redacts key material.
-
Method Details
-
fromPrivateKeyAndCertificate
public static @NonNull SamlCredential fromPrivateKeyAndCertificate(@NonNull PrivateKey key, @NonNull X509Certificate certificate) Pairs an RSA private key with a matching RSA certificate.- Parameters:
key- private key, at least 2048 bitscertificate- certificate with the matching RSA modulus- Returns:
- immutable credential
- Since:
- 1.0.0
-
fromKeyStore
public static @NonNull SamlCredential fromKeyStore(@NonNull KeyStore store, @NonNull String alias, char @NonNull [] password) Loads an RSA key pair from an application-owned KeyStore.- Parameters:
store- key storealias- key entry aliaspassword- entry password- Returns:
- matching credential
- Since:
- 1.0.0
-
fromPem
public static @NonNull SamlCredential fromPem(@NonNull String privateKeyPem, @NonNull String certificatePem) Loads an unencrypted PKCS#8 or PKCS#1 RSA private key and one X.509 certificate from separate PEM blocks. Invalid armor, DER, key strength or key pairing fails closed.- Parameters:
privateKeyPem- one private key PEM blockcertificatePem- one certificate PEM block- Returns:
- matching credential
- Since:
- 1.0.0
-
getCertificate
Returns the certificate for SP metadata.- Returns:
- X.509 certificate
- Since:
- 1.0.0
-
toString
-