Package org.opensaml.security.crypto
Class KeySupportTest
java.lang.Object
org.opensaml.security.crypto.KeySupportTest
Unit test for
KeySupport.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringLocation of non-encrypted, DER formatted, dSA private key.private StringLocation of encrypted, PEM formatted, DSA private key.private StringLocation of non-encrypted, PEM formatted, dSA private key.private StringLocation of non-encrypted, PEM formatted, EC private key.private static final StringAn invalid base64 string.private final org.slf4j.Loggerprivate char[]Password for private key.private StringLocation of non-encrypted, DER formatted, RSA private key.private StringLocation of encrypted, PEM formatted, RSA private key.private StringLocation of non-encrypted, PEM formatted, RSA private key. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionObject[][]voidvoidvoidvoidTest decoding an DSA private key, in DER format, without encryption.voidTest decoding an DSA private key, in PEM format, with encryption.voidTest decoding an DSA private key, in PEM format, without encryption.voidTest decoding an EC private key, in PEM format, without encryption.voidTest decoding an RSA private key, in DER format, without encryption.voidTest decoding an RSA private key, in PEM format, with encryption.voidTest decoding an RSA private key, in PEM format, without encryption.voidtestDecodeSecretKey(Integer keyLengthBits, String algorithm) voidTest deriving a public key from an RSA, DSA and EC private key.voidvoidTest the evaluation that 2 keys are members of the same key pair.protected PrivateKeytestPrivKey(String keyFile, char[] password, String algo) Generic key testing.
-
Field Details
-
log
private final org.slf4j.Logger log -
rsaPrivKeyPEMNoEncrypt
Location of non-encrypted, PEM formatted, RSA private key. -
rsaPrivKeyDERNoEncrypt
Location of non-encrypted, DER formatted, RSA private key. -
dsaPrivKeyPEMNoEncrypt
Location of non-encrypted, PEM formatted, dSA private key. -
dsaPrivKeyDERNoEncrypt
Location of non-encrypted, DER formatted, dSA private key. -
privKeyPassword
private char[] privKeyPasswordPassword for private key. -
rsaPrivKeyPEMEncrypt
Location of encrypted, PEM formatted, RSA private key. -
dsaPrivKeyPEMEncrypt
Location of encrypted, PEM formatted, DSA private key. -
ecPrivKeyPEMNoEncrypt
Location of non-encrypted, PEM formatted, EC private key. -
INVALID_BASE64_KEY
An invalid base64 string.- See Also:
-
-
Constructor Details
-
KeySupportTest
public KeySupportTest()
-
-
Method Details
-
testDecodeRSAPrivateKeyPEMNoEncrypt
Test decoding an RSA private key, in PEM format, without encryption.- Throws:
Exception- if something goes wrong
-
testDecodeRSAPrivateKeyPEMEncrypt
Test decoding an RSA private key, in PEM format, with encryption.- Throws:
Exception- if something goes wrong
-
testDecodeRSAPrivateKeyDERNoEncrypt
Test decoding an RSA private key, in DER format, without encryption.- Throws:
Exception- if something goes wrong
-
testDecodeDSAPrivateKeyPEMNoEncrypt
Test decoding an DSA private key, in PEM format, without encryption.- Throws:
Exception- if something goes wrong
-
testDecodeDSAPrivateKeyPEMEncrypt
Test decoding an DSA private key, in PEM format, with encryption.- Throws:
Exception- if something goes wrong
-
testDecodeDSAPrivateKeyDERNoEncrypt
Test decoding an DSA private key, in DER format, without encryption.- Throws:
Exception- if something goes wrong
-
testDecodeECPrivateKeyPEMNoEncrypt
Test decoding an EC private key, in PEM format, without encryption.- Throws:
Exception- if something goes wrong
-
testDerivePublicKey
Test deriving a public key from an RSA, DSA and EC private key.- Throws:
Exception- if something goes wrong
-
testKeyPairMatching
public void testKeyPairMatching() throws NoSuchAlgorithmException, NoSuchProviderException, SecurityExceptionTest the evaluation that 2 keys are members of the same key pair.- Throws:
NoSuchProviderException- ...NoSuchAlgorithmException- ...SecurityException- ...
-
testKeyLength
-
decodeSecretKeyData
-
testDecodeSecretKey
public void testDecodeSecretKey(Integer keyLengthBits, String algorithm) throws NoSuchAlgorithmException, KeyException - Throws:
NoSuchAlgorithmExceptionKeyException
-
testBuildJavaDSAPublicKeyWithInvalidBase64
- Throws:
KeyException
-
testBuildJavaRSAPublicKeyWithInvalidBase64
- Throws:
KeyException
-
testBuildJavaECPublicKeyWithInvalidBase64
- Throws:
KeyException
-
testPrivKey
Generic key testing.- Parameters:
keyFile- ...password- ...algo- ...- Returns:
- the private key
- Throws:
Exception- if something goes wrong
-