Class KeySupportTest

java.lang.Object
org.opensaml.security.crypto.KeySupportTest

public class KeySupportTest extends Object
Unit test for KeySupport.
  • Field Details

    • log

      private final org.slf4j.Logger log
    • rsaPrivKeyPEMNoEncrypt

      private String rsaPrivKeyPEMNoEncrypt
      Location of non-encrypted, PEM formatted, RSA private key.
    • rsaPrivKeyDERNoEncrypt

      private String rsaPrivKeyDERNoEncrypt
      Location of non-encrypted, DER formatted, RSA private key.
    • dsaPrivKeyPEMNoEncrypt

      private String dsaPrivKeyPEMNoEncrypt
      Location of non-encrypted, PEM formatted, dSA private key.
    • dsaPrivKeyDERNoEncrypt

      private String dsaPrivKeyDERNoEncrypt
      Location of non-encrypted, DER formatted, dSA private key.
    • privKeyPassword

      private char[] privKeyPassword
      Password for private key.
    • rsaPrivKeyPEMEncrypt

      private String rsaPrivKeyPEMEncrypt
      Location of encrypted, PEM formatted, RSA private key.
    • dsaPrivKeyPEMEncrypt

      private String dsaPrivKeyPEMEncrypt
      Location of encrypted, PEM formatted, DSA private key.
    • ecPrivKeyPEMNoEncrypt

      private String ecPrivKeyPEMNoEncrypt
      Location of non-encrypted, PEM formatted, EC private key.
    • INVALID_BASE64_KEY

      private static final String INVALID_BASE64_KEY
      An invalid base64 string.
      See Also:
  • Constructor Details

    • KeySupportTest

      public KeySupportTest()
  • Method Details

    • testDecodeRSAPrivateKeyPEMNoEncrypt

      public void testDecodeRSAPrivateKeyPEMNoEncrypt() throws Exception
      Test decoding an RSA private key, in PEM format, without encryption.
      Throws:
      Exception - if something goes wrong
    • testDecodeRSAPrivateKeyPEMEncrypt

      public void testDecodeRSAPrivateKeyPEMEncrypt() throws Exception
      Test decoding an RSA private key, in PEM format, with encryption.
      Throws:
      Exception - if something goes wrong
    • testDecodeRSAPrivateKeyDERNoEncrypt

      public void testDecodeRSAPrivateKeyDERNoEncrypt() throws Exception
      Test decoding an RSA private key, in DER format, without encryption.
      Throws:
      Exception - if something goes wrong
    • testDecodeDSAPrivateKeyPEMNoEncrypt

      public void testDecodeDSAPrivateKeyPEMNoEncrypt() throws Exception
      Test decoding an DSA private key, in PEM format, without encryption.
      Throws:
      Exception - if something goes wrong
    • testDecodeDSAPrivateKeyPEMEncrypt

      public void testDecodeDSAPrivateKeyPEMEncrypt() throws Exception
      Test decoding an DSA private key, in PEM format, with encryption.
      Throws:
      Exception - if something goes wrong
    • testDecodeDSAPrivateKeyDERNoEncrypt

      public void testDecodeDSAPrivateKeyDERNoEncrypt() throws Exception
      Test decoding an DSA private key, in DER format, without encryption.
      Throws:
      Exception - if something goes wrong
    • testDecodeECPrivateKeyPEMNoEncrypt

      public void testDecodeECPrivateKeyPEMNoEncrypt() throws Exception
      Test decoding an EC private key, in PEM format, without encryption.
      Throws:
      Exception - if something goes wrong
    • testDerivePublicKey

      public void testDerivePublicKey() throws Exception
      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, SecurityException
      Test the evaluation that 2 keys are members of the same key pair.
      Throws:
      NoSuchProviderException - ...
      NoSuchAlgorithmException - ...
      SecurityException - ...
    • testKeyLength

      public void testKeyLength() throws NoSuchAlgorithmException, NoSuchProviderException
      Throws:
      NoSuchAlgorithmException
      NoSuchProviderException
    • decodeSecretKeyData

      @DataProvider public Object[][] decodeSecretKeyData()
    • testDecodeSecretKey

      public void testDecodeSecretKey(Integer keyLengthBits, String algorithm) throws NoSuchAlgorithmException, KeyException
      Throws:
      NoSuchAlgorithmException
      KeyException
    • testBuildJavaDSAPublicKeyWithInvalidBase64

      public void testBuildJavaDSAPublicKeyWithInvalidBase64() throws KeyException
      Throws:
      KeyException
    • testBuildJavaRSAPublicKeyWithInvalidBase64

      public void testBuildJavaRSAPublicKeyWithInvalidBase64() throws KeyException
      Throws:
      KeyException
    • testBuildJavaECPublicKeyWithInvalidBase64

      public void testBuildJavaECPublicKeyWithInvalidBase64() throws KeyException
      Throws:
      KeyException
    • testPrivKey

      protected PrivateKey testPrivKey(String keyFile, char[] password, String algo) throws Exception
      Generic key testing.
      Parameters:
      keyFile - ...
      password - ...
      algo - ...
      Returns:
      the private key
      Throws:
      Exception - if something goes wrong