Class PBES2CipherTest


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

      • PBES2CipherTest

        public PBES2CipherTest()
    • Method Detail

      • testPBES2_EmptyPassword_Fixed_Salt_ICount_IV_1Byte

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        public void testPBES2_No_Params()
                                 throws java.lang.Exception
        Test the all supported PBES2 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.
      • testPBES2_Wrong_Params

        public void testPBES2_Wrong_Params()
                                    throws java.lang.Exception
        Test the all supported PBES2 ciphers with bad parameters. Expected exceptions if: non-ASCII password is provided, small salt is provided, negative iteration count is provided or no IV is provided for the encryption cipher (in which case the encryption cipher will generate a random one, but the decrypting cipher will not have it so it can't decrypt).
        Throws:
        java.lang.Exception - if the encryption or decryption fails.