Class KeySupportTest


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

      • 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.
    • Constructor Detail

      • KeySupportTest

        public KeySupportTest()
    • Method Detail

      • 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 and DSA private key.
        Throws:
        Exception - if something goes wrong
      • 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