Class PKCS12PBECipherTest


  • public class PKCS12PBECipherTest
    extends java.lang.Object
    • Constructor Detail

      • PKCS12PBECipherTest

        public PKCS12PBECipherTest()
    • Method Detail

      • testPKCS12PBE_EmptyPassword_Fixed_Salt_ICount_1Byte

        public void testPKCS12PBE_EmptyPassword_Fixed_Salt_ICount_1Byte()
                                                                 throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with an empty password, fixed salt and iteration count, encrypting 1 byte of data. Compare encrypted data against expected data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_EmptyPassword_Fixed_Salt_ICount_16Bytes

        public void testPKCS12PBE_EmptyPassword_Fixed_Salt_ICount_16Bytes()
                                                                   throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with an empty password, fixed salt and iteration count, encrypting 16 bytes of data. Compare encrypted data against expected data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_EmptyPassword_Fixed_Salt_ICount_80Bytes

        public void testPKCS12PBE_EmptyPassword_Fixed_Salt_ICount_80Bytes()
                                                                   throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with an empty password, fixed salt and iteration count, encrypting 80 bytes of data. Compare encrypted data against expected data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Fixed_1BytePassword_Fixed_Salt_ICount_1Byte

        public void testPKCS12PBE_Fixed_1BytePassword_Fixed_Salt_ICount_1Byte()
                                                                       throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a fixed 1Byte password, fixed salt and iteration count, encrypting 1 byte of data. Compare encrypted data against expected data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Fixed_1BytePassword_Fixed_Salt_ICount_16Bytes

        public void testPKCS12PBE_Fixed_1BytePassword_Fixed_Salt_ICount_16Bytes()
                                                                         throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a fixed 1Byte password, fixed salt and iteration count, encrypting 16 bytes of data. Compare encrypted data against expected data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Fixed_1BytePassword_Fixed_Salt_ICount_80Bytes

        public void testPKCS12PBE_Fixed_1BytePassword_Fixed_Salt_ICount_80Bytes()
                                                                         throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a fixed 1Byte password, fixed salt and iteration count, encrypting 80 bytes of data. Compare encrypted data against expected data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Fixed_16BytesPassword_Fixed_Salt_ICount_1Byte

        public void testPKCS12PBE_Fixed_16BytesPassword_Fixed_Salt_ICount_1Byte()
                                                                         throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a fixed 16Bytes password, fixed salt and iteration count, encrypting 1 byte of data. Compare encrypted data against expected data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Fixed_16BytesPassword_Fixed_Salt_ICount_16Bytes

        public void testPKCS12PBE_Fixed_16BytesPassword_Fixed_Salt_ICount_16Bytes()
                                                                           throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a fixed 16Bytes password, fixed salt and iteration count, encrypting 16 bytes of data. Compare encrypted data against expected data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Fixed_16BytesPassword_Fixed_Salt_ICount_80Bytes

        public void testPKCS12PBE_Fixed_16BytesPassword_Fixed_Salt_ICount_80Bytes()
                                                                           throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a fixed 16Bytes password, fixed salt and iteration count, encrypting 80 bytes of data. Compare encrypted data against expected data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Fixed_32BytesPassword_Fixed_Salt_ICount_1Byte

        public void testPKCS12PBE_Fixed_32BytesPassword_Fixed_Salt_ICount_1Byte()
                                                                         throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a fixed 32Bytes password, fixed salt and iteration count, encrypting 1 byte of data. Compare encrypted data against expected data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Fixed_32BytesPassword_Fixed_Salt_ICount_16Bytes

        public void testPKCS12PBE_Fixed_32BytesPassword_Fixed_Salt_ICount_16Bytes()
                                                                           throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a fixed 32Bytes password, fixed salt and iteration count, encrypting 16 bytes of data. Compare encrypted data against expected data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Fixed_32BytesPassword_Fixed_Salt_ICount_80Bytes

        public void testPKCS12PBE_Fixed_32BytesPassword_Fixed_Salt_ICount_80Bytes()
                                                                           throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a fixed 32Bytes password, fixed salt and iteration count, encrypting 80 bytes of data. Compare encrypted data against expected data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Fixed_64BytesPassword_Fixed_Salt_ICount_1Byte

        public void testPKCS12PBE_Fixed_64BytesPassword_Fixed_Salt_ICount_1Byte()
                                                                         throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a fixed 64Bytes password, fixed salt and iteration count, encrypting 1 byte of data. Compare encrypted data against expected data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Fixed_64BytesPassword_Fixed_Salt_ICount_16Bytes

        public void testPKCS12PBE_Fixed_64BytesPassword_Fixed_Salt_ICount_16Bytes()
                                                                           throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a fixed 64Bytes password, fixed salt and iteration count, encrypting 16 bytes of data. Compare encrypted data against expected data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Fixed_64BytesPassword_Fixed_Salt_ICount_80Bytes

        public void testPKCS12PBE_Fixed_64BytesPassword_Fixed_Salt_ICount_80Bytes()
                                                                           throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a fixed 64Bytes password, fixed salt and iteration count, encrypting 80 bytes of data. Compare encrypted data against expected data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Fixed_Password_Fixed_Salt_ICount_IV

        public void testPKCS12PBE_Fixed_Password_Fixed_Salt_ICount_IV()
                                                               throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a fixed 32Bytes password (size irrelevant), fixed salt and iteration count, encrypting 80 bytes of data (size irrelevant). IV is also added to the cipher, which will be ignored as PKCS12 PBE ciphers will derive the IV from the password and salt and this is the main scope of this test. Compare encrypted data against expected data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Random_1BytePassword_Random_Salt_ICount_1Byte

        public void testPKCS12PBE_Random_1BytePassword_Random_Salt_ICount_1Byte()
                                                                         throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a random 1Byte password, random salt and iteration count, encrypting 1 byte of data. Compare encrypted data against decrypted data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Random_1BytePassword_Random_Salt_ICount_16Bytes

        public void testPKCS12PBE_Random_1BytePassword_Random_Salt_ICount_16Bytes()
                                                                           throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a random 1Byte password, random salt and iteration count, encrypting 16 bytes of data. Compare encrypted data against decrypted data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Random_1BytePassword_Random_Salt_ICount_80Bytes

        public void testPKCS12PBE_Random_1BytePassword_Random_Salt_ICount_80Bytes()
                                                                           throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a random 1Byte password, random salt and iteration count, encrypting 80 bytes of data. Compare encrypted data against decrypted data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Random_16BytesPassword_Random_Salt_ICount_1Byte

        public void testPKCS12PBE_Random_16BytesPassword_Random_Salt_ICount_1Byte()
                                                                           throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a random 16Bytes password, random salt and iteration count, encrypting 1 byte of data. Compare encrypted data against decrypted data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Random_16BytesPassword_Random_Salt_ICount_16Bytes

        public void testPKCS12PBE_Random_16BytesPassword_Random_Salt_ICount_16Bytes()
                                                                             throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a random 16Bytes password, random salt and iteration count, encrypting 16 bytes of data. Compare encrypted data against decrypted data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Random_16BytesPassword_Random_Salt_ICount_80Bytes

        public void testPKCS12PBE_Random_16BytesPassword_Random_Salt_ICount_80Bytes()
                                                                             throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a random 16Bytes password, random salt and iteration count, encrypting 80 bytes of data. Compare encrypted data against decrypted data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Random_32BytesPassword_Random_Salt_ICount_1Byte

        public void testPKCS12PBE_Random_32BytesPassword_Random_Salt_ICount_1Byte()
                                                                           throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a random 32Bytes password, random salt and iteration count, encrypting 1 byte of data. Compare encrypted data against decrypted data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Random_32BytesPassword_Random_Salt_ICount_16Bytes

        public void testPKCS12PBE_Random_32BytesPassword_Random_Salt_ICount_16Bytes()
                                                                             throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a random 32Bytes password, random salt and iteration count, encrypting 16 bytes of data. Compare encrypted data against decrypted data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Random_32BytesPassword_Random_Salt_ICount_80Bytes

        public void testPKCS12PBE_Random_32BytesPassword_Random_Salt_ICount_80Bytes()
                                                                             throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a random 32Bytes password, random salt and iteration count, encrypting 80 bytes of data. Compare encrypted data against decrypted data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Random_64BytesPassword_Random_Salt_ICount_1Byte

        public void testPKCS12PBE_Random_64BytesPassword_Random_Salt_ICount_1Byte()
                                                                           throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a random 64Bytes password, random salt and iteration count, encrypting 1 byte of data. Compare encrypted data against decrypted data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Random_64BytesPassword_Random_Salt_ICount_16Bytes

        public void testPKCS12PBE_Random_64BytesPassword_Random_Salt_ICount_16Bytes()
                                                                             throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a random 64Bytes password, random salt and iteration count, encrypting 16 bytes of data. Compare encrypted data against decrypted data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_Random_64BytesPassword_Random_Salt_ICount_80Bytes

        public void testPKCS12PBE_Random_64BytesPassword_Random_Salt_ICount_80Bytes()
                                                                             throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with a random 64Bytes password, random salt and iteration count, encrypting 80 bytes of data. Compare encrypted data against decrypted data.
        Throws:
        java.lang.Exception - if the encryption fails.
      • testPKCS12PBE_No_Params

        public void testPKCS12PBE_No_Params()
                                     throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers without any parameters, encrypting 80 bytes of data (size irrelevant). Encrypting data is expected to be successful, as the cipher will generate random salt and default to a certain iteration count, but decrypting data is expected to fail since it cannot retrieve the internally generated parameters of the encrypting cipher, and this is the actual scope of the test case.
        Throws:
        java.lang.Exception - if the encryption or decryption fails.
      • testPKCS12PBE_Wrong_Params

        public void testPKCS12PBE_Wrong_Params()
                                        throws java.lang.Exception
        Test the all supported PKCS12 PBE ciphers with bad parameters. Expected exceptions if: non-ASCII password is provided, small salt is provided or negative iteration count is provided.
        Throws:
        java.lang.Exception - if the encryption or decryption fails.