IT. Expert System.

Android Reference

EncryptedPrivateKeyInfoTest


org.apache.harmony.crypto.tests.javax.crypto

Class EncryptedPrivateKeyInfoTest

  • java.lang.Object
    • TestCase
      • org.apache.harmony.crypto.tests.javax.crypto.EncryptedPrivateKeyInfoTest


  • public class EncryptedPrivateKeyInfoTest
    extends TestCase
    Test for EncryptedPrivateKeyInfo class. All binary data for this test were generated using BEA JRockit j2sdk1.4.2_04 (http://www.bea.com) with security providers list extended by Bouncy Castle's one (http://www.bouncycastle.org)
    • Method Summary

      Methods
      Modifier and Type Method and Description
      protected void setUp()
      void test_getAlgName()
      void test_ROUNDTRIP_GetKeySpecCipher01()
      Encrypted data contains valid PKCS8 key info encoding
      void test_ROUNDTRIP_GetKeySpecCipher02()
      Encrypted data contains invalid PKCS8 key info encoding
      void test_ROUNDTRIP_GetKeySpecKey01()
      Encrypted data contains valid PKCS8 key info encoding
      void test_ROUNDTRIP_GetKeySpecKey02()
      Encrypted data contains invalid PKCS8 key info encoding
      void test_ROUNDTRIP_GetKeySpecKeyProvider01()
      Encrypted data contains valid PKCS8 key info encoding
      void test_ROUNDTRIP_GetKeySpecKeyProvider02()
      Encrypted data contains invalid PKCS8 key info encoding
      void test_ROUNDTRIP_GetKeySpecKeyString01()
      Encrypted data contains valid PKCS8 key info encoding
      void test_ROUNDTRIP_GetKeySpecKeyString02()
      Encrypted data contains invalid PKCS8 key info encoding
      void testEncryptedPrivateKeyInfoAlgorithmParametersbyteArray1()
      Test #1 for EncryptedPrivateKeyInfo(java.security.AlgorithmParameters, byte[]) constructor
      Assertion: creates EncryptedPrivateKeyInfo instance
      Test preconditions: valid parameters passed
      Expected: must pass without any exceptions
      void testEncryptedPrivateKeyInfoAlgorithmParametersbyteArray2()
      Test #2 for EncryptedPrivateKeyInfo(java.security.AlgorithmParameters, byte[]) constructor
      Assertion: NullPointerException- if the specified algorithm parameters or encrypted data is null
      Test preconditions: pass null as algorithm parameters then as encrypted data
      Expected: NullPointerException in both cases
      void testEncryptedPrivateKeyInfoAlgorithmParametersbyteArray3()
      Test #3 for EncryptedPrivateKeyInfo(java.security.AlgorithmParameters, byte[]) constructor
      Assertion: IllegalArgumentException- if encrypted data is empty, i.e.
      void testEncryptedPrivateKeyInfoAlgorithmParametersbyteArray4()
      Test #4 for EncryptedPrivateKeyInfo(java.security.AlgorithmParameters, byte[]) constructor
      Assertion: byte array is copied to prevent subsequent modification
      Test preconditions: valid array passed then modified
      Expected: getEncryptedData(), invoked after above modification, must return array as it was before the modification
      void testEncryptedPrivateKeyInfobyteArray1()
      Test #1 for EncryptedPrivateKeyInfo(byte[]) constructor
      Assertion: creates EncryptedPrivateKeyInfo instance
      Test preconditions: valid parameters passed
      Expected: must pass without any exceptions
      void testEncryptedPrivateKeyInfobyteArray2()
      Test #2 for EncryptedPrivateKeyInfo(byte[]) constructor
      Assertion: NullPointerException if encoding is null
      Test preconditions: null passed as a parameter
      Expected: NullPointerException
      void testEncryptedPrivateKeyInfobyteArray3()
      Test #3 for EncryptedPrivateKeyInfo(byte[]) constructor
      Assertion: IOException if encoding is wrong
      Test preconditions: wrong encoding passed as a parameter
      Expected: IOException
      void testEncryptedPrivateKeyInfobyteArray4()
      Test #4 for EncryptedPrivateKeyInfo(byte[]) constructor
      Assertion: IOException if encoding is wrong
      Test preconditions: wrong encoding passed as a parameter
      Expected: IOException
      void testEncryptedPrivateKeyInfobyteArray5()
      Test #5 for EncryptedPrivateKeyInfo(byte[]) constructor
      Assertion: IOException if encoding is wrong
      Test preconditions: wrong encoding passed as a parameter
      Expected: IOException
      void testEncryptedPrivateKeyInfobyteArray6()
      Test #6 for EncryptedPrivateKeyInfo(byte[]) constructor
      Assertion: byte array is copied to prevent subsequent modification
      Test preconditions: valid array passed then modified
      Expected: getEncoded(), invoked after above modification, must return array as it was before the modification
      void testEncryptedPrivateKeyInfoStringbyteArray1()
      Test #1 for EncryptedPrivateKeyInfo(String, byte[]) constructor
      Assertion: creates EncryptedPrivateKeyInfo instance
      Test preconditions: valid parameters passed
      Expected: must pass without any exceptions
      void testEncryptedPrivateKeyInfoStringbyteArray2()
      Test #2 for EncryptedPrivateKeyInfo(String, byte[]) constructor
      Assertion: NoSuchAlgorithmException- if the specified algorithm is not supported
      Test preconditions: pass nonexistent algorithm name
      Expected: NoSuchAlgorithmException
      void testEncryptedPrivateKeyInfoStringbyteArray3()
      Test #3 for EncryptedPrivateKeyInfo(String, byte[]) constructor
      Assertion: NullPointerException- if the specified algorithm or encrypted data is null
      Test preconditions: pass null as algorithm name then as encrypted data
      Expected: NullPointerException in both cases
      void testEncryptedPrivateKeyInfoStringbyteArray4()
      Test #4 for EncryptedPrivateKeyInfo(String, byte[]) constructor
      Assertion: IllegalArgumentException- if encrypted data is empty, i.e.
      void testEncryptedPrivateKeyInfoStringbyteArray5()
      Test #5 for EncryptedPrivateKeyInfo(String, byte[]) constructor
      Assertion: byte array is copied to prevent subsequent modification
      Test preconditions: valid array passed then modified
      Expected: getEncryptedData(), invoked after above modification, must return array as it was before the modification
      void testEncryptedPrivateKeyInfoStringbyteArray6()
      javax/crypto/EncryptedPrivateKeyInfo(String, byte[]) Checks exception order
      void testGetAlgParameters01_01()
      void testGetAlgParameters01()
      Test #1 for getAlgParameters() method
      Assertion: returns the algorithm parameters
      Test preconditions: test object created using ctor which takes encoded form as the only parameter; encoded form passed contains algorithm parameters encoding
      Expected: corresponding algorithm parameters must be returned
      void testGetAlgParameters02()
      Test #2 for getAlgParameters() method
      Assertion: returns the algorithm parameters
      Test preconditions: test object created using ctor which takes encoded form as the only parameter; encoded form passed does not contain algorithm parameters encoding
      Expected: null must be returned
      void testGetAlgParameters03()
      Test #3 for getAlgParameters() method
      Assertion: returns the algorithm parameters
      Test #6 for EncryptedPrivateKeyInfo(String, byte[]) constructor
      Assertion: ...This constructor will use null as the value of the algorithm parameters.
      void testGetAlgParameters04()
      Test #4 for getAlgParameters() method
      Assertion: returns the algorithm parameters
      Test preconditions: test object created using ctor which takes AlgorithmParameters and encrypted data as a parameters;
      Expected: the same algorithm parameters as ones passed to the ctor must be returned
      void testGetEncoded01()
      Test #1 for getEncoded() method
      Assertion: returns the ASN.1 encoding of this object
      Test preconditions: test object created using ctor which takes encoded form as the only parameter
      Expected: equivalent encoded form must be returned
      void testGetEncoded02()
      Test #2 for getEncoded() method
      Assertion: returns the ASN.1 encoding of this object
      Test preconditions: test object created using ctor which takes algorithm name and encrypted data as a parameters
      Expected: equivalent encoded form (without alg params) must be returned
      void testGetEncoded03()
      Test #3 for getEncoded() method
      Assertion: returns the ASN.1 encoding of this object
      Test preconditions: test object created using ctor which takes algorithm name and encrypted data as a parameters
      Expected: equivalent encoded form (without alg params) must be returned
      void testGetEncoded04()
      Test #4 for getEncoded() method
      Assertion: returns a new array each time this method is called
      Test preconditions: test object created using ctor which takes algorithm name and encrypted data as a parameters
      Expected: several refs to byte array returned by the method under test must be different
      void testGetEncryptedData01()
      Test #1 for getEncryptedData() method
      Assertion: returns the encrypted data
      Test preconditions: test object created using ctor which takes encoded form as the only parameter; encoded form passed contains encrypted data
      Expected: the equivalent encrypted data must be returned
      void testGetEncryptedData02()
      Test #2 for getEncryptedData() method
      Assertion: returns the encrypted data
      Test preconditions: test object created using ctor which takes algorithm name and encrypted data as a parameters
      Expected: the equivalent encrypted data must be returned
      void testGetEncryptedData03()
      Test #3 for getEncryptedData() method
      Assertion: returns the encrypted data
      Test preconditions: test object created using ctor which takes algorithm parameters and encrypted data as a parameters
      Expected: the equivalent encrypted data must be returned
      void testGetEncryptedData04()
      Test #4 for getEncryptedData() method
      Assertion: returns a new array each time this method is called
      Test preconditions: test object created using ctor which takes algorithm name and encrypted data as a parameters
      Expected: refs to encrypted data byte array passed to the ctor and returned by the method under test must be different
      void testGetKeySpecCipher01()
      void testGetKeySpecKey01()
      void testGetKeySpecKeyProvider01()
      void testGetKeySpecKeyString01()
    • Constructor Detail

      • EncryptedPrivateKeyInfoTest

        public EncryptedPrivateKeyInfoTest()
    • Method Detail

      • test_getAlgName

        public void test_getAlgName()
      • testEncryptedPrivateKeyInfobyteArray1

        public final void testEncryptedPrivateKeyInfobyteArray1()
                                                         throws Exception
        Test #1 for EncryptedPrivateKeyInfo(byte[]) constructor
        Assertion: creates EncryptedPrivateKeyInfo instance
        Test preconditions: valid parameters passed
        Expected: must pass without any exceptions
        Throws:
        IOException
        NoSuchAlgorithmException
        Exception
      • testEncryptedPrivateKeyInfobyteArray2

        public final void testEncryptedPrivateKeyInfobyteArray2()
                                                         throws IOException
        Test #2 for EncryptedPrivateKeyInfo(byte[]) constructor
        Assertion: NullPointerException if encoding is null
        Test preconditions: null passed as a parameter
        Expected: NullPointerException
        Throws:
        IOException
      • testEncryptedPrivateKeyInfobyteArray3

        public final void testEncryptedPrivateKeyInfobyteArray3()
        Test #3 for EncryptedPrivateKeyInfo(byte[]) constructor
        Assertion: IOException if encoding is wrong
        Test preconditions: wrong encoding passed as a parameter
        Expected: IOException
      • testEncryptedPrivateKeyInfobyteArray4

        public final void testEncryptedPrivateKeyInfobyteArray4()
        Test #4 for EncryptedPrivateKeyInfo(byte[]) constructor
        Assertion: IOException if encoding is wrong
        Test preconditions: wrong encoding passed as a parameter
        Expected: IOException
      • testEncryptedPrivateKeyInfobyteArray5

        public final void testEncryptedPrivateKeyInfobyteArray5()
                                                         throws Exception
        Test #5 for EncryptedPrivateKeyInfo(byte[]) constructor
        Assertion: IOException if encoding is wrong
        Test preconditions: wrong encoding passed as a parameter
        Expected: IOException
        Throws:
        Exception
      • testEncryptedPrivateKeyInfobyteArray6

        public final void testEncryptedPrivateKeyInfobyteArray6()
                                                         throws Exception
        Test #6 for EncryptedPrivateKeyInfo(byte[]) constructor
        Assertion: byte array is copied to prevent subsequent modification
        Test preconditions: valid array passed then modified
        Expected: getEncoded(), invoked after above modification, must return array as it was before the modification
        Throws:
        IOException
        Exception
      • testEncryptedPrivateKeyInfoStringbyteArray1

        public final void testEncryptedPrivateKeyInfoStringbyteArray1()
        Test #1 for EncryptedPrivateKeyInfo(String, byte[]) constructor
        Assertion: creates EncryptedPrivateKeyInfo instance
        Test preconditions: valid parameters passed
        Expected: must pass without any exceptions
      • testEncryptedPrivateKeyInfoStringbyteArray2

        public final void testEncryptedPrivateKeyInfoStringbyteArray2()
        Test #2 for EncryptedPrivateKeyInfo(String, byte[]) constructor
        Assertion: NoSuchAlgorithmException- if the specified algorithm is not supported
        Test preconditions: pass nonexistent algorithm name
        Expected: NoSuchAlgorithmException
      • testEncryptedPrivateKeyInfoStringbyteArray3

        public final void testEncryptedPrivateKeyInfoStringbyteArray3()
                                                               throws NoSuchAlgorithmException
        Test #3 for EncryptedPrivateKeyInfo(String, byte[]) constructor
        Assertion: NullPointerException- if the specified algorithm or encrypted data is null
        Test preconditions: pass null as algorithm name then as encrypted data
        Expected: NullPointerException in both cases
        Throws:
        NoSuchAlgorithmException
      • testEncryptedPrivateKeyInfoStringbyteArray4

        public final void testEncryptedPrivateKeyInfoStringbyteArray4()
                                                               throws Exception
        Test #4 for EncryptedPrivateKeyInfo(String, byte[]) constructor
        Assertion: IllegalArgumentException- if encrypted data is empty, i.e. 0-length
        Test preconditions: pass empty encrypted data
        Expected: IllegalArgumentException
        Throws:
        Exception
      • testEncryptedPrivateKeyInfoStringbyteArray5

        public final void testEncryptedPrivateKeyInfoStringbyteArray5()
                                                               throws Exception
        Test #5 for EncryptedPrivateKeyInfo(String, byte[]) constructor
        Assertion: byte array is copied to prevent subsequent modification
        Test preconditions: valid array passed then modified
        Expected: getEncryptedData(), invoked after above modification, must return array as it was before the modification
        Throws:
        IOException
        Exception
      • testEncryptedPrivateKeyInfoStringbyteArray6

        public final void testEncryptedPrivateKeyInfoStringbyteArray6()
        javax/crypto/EncryptedPrivateKeyInfo(String, byte[]) Checks exception order
      • testEncryptedPrivateKeyInfoAlgorithmParametersbyteArray1

        public final void testEncryptedPrivateKeyInfoAlgorithmParametersbyteArray1()
                                                                            throws IOException,
                                                                                   NoSuchAlgorithmException
        Test #1 for EncryptedPrivateKeyInfo(java.security.AlgorithmParameters, byte[]) constructor
        Assertion: creates EncryptedPrivateKeyInfo instance
        Test preconditions: valid parameters passed
        Expected: must pass without any exceptions
        Throws:
        IOException
        NoSuchAlgorithmException
      • testEncryptedPrivateKeyInfoAlgorithmParametersbyteArray2

        public final void testEncryptedPrivateKeyInfoAlgorithmParametersbyteArray2()
                                                                            throws NoSuchAlgorithmException,
                                                                                   IOException
        Test #2 for EncryptedPrivateKeyInfo(java.security.AlgorithmParameters, byte[]) constructor
        Assertion: NullPointerException- if the specified algorithm parameters or encrypted data is null
        Test preconditions: pass null as algorithm parameters then as encrypted data
        Expected: NullPointerException in both cases
        Throws:
        NoSuchAlgorithmException
        IOException
      • testEncryptedPrivateKeyInfoAlgorithmParametersbyteArray3

        public final void testEncryptedPrivateKeyInfoAlgorithmParametersbyteArray3()
                                                                            throws Exception
        Test #3 for EncryptedPrivateKeyInfo(java.security.AlgorithmParameters, byte[]) constructor
        Assertion: IllegalArgumentException- if encrypted data is empty, i.e. 0-length
        Test preconditions: pass empty encrypted data
        Expected: IllegalArgumentException
        Throws:
        NoSuchAlgorithmException
        IOException
        Exception
      • testEncryptedPrivateKeyInfoAlgorithmParametersbyteArray4

        public final void testEncryptedPrivateKeyInfoAlgorithmParametersbyteArray4()
                                                                            throws Exception
        Test #4 for EncryptedPrivateKeyInfo(java.security.AlgorithmParameters, byte[]) constructor
        Assertion: byte array is copied to prevent subsequent modification
        Test preconditions: valid array passed then modified
        Expected: getEncryptedData(), invoked after above modification, must return array as it was before the modification
        Throws:
        IOException
        Exception
      • testGetAlgParameters01

        public final void testGetAlgParameters01()
                                          throws IOException
        Test #1 for getAlgParameters() method
        Assertion: returns the algorithm parameters
        Test preconditions: test object created using ctor which takes encoded form as the only parameter; encoded form passed contains algorithm parameters encoding
        Expected: corresponding algorithm parameters must be returned
        Throws:
        IOException
      • testGetAlgParameters01_01

        public final void testGetAlgParameters01_01()
                                             throws Exception
        Throws:
        Exception
      • testGetAlgParameters02

        public final void testGetAlgParameters02()
                                          throws IOException
        Test #2 for getAlgParameters() method
        Assertion: returns the algorithm parameters
        Test preconditions: test object created using ctor which takes encoded form as the only parameter; encoded form passed does not contain algorithm parameters encoding
        Expected: null must be returned
        Throws:
        IOException
      • testGetAlgParameters03

        public final void testGetAlgParameters03()
                                          throws IOException
        Test #3 for getAlgParameters() method
        Assertion: returns the algorithm parameters
        Test #6 for EncryptedPrivateKeyInfo(String, byte[]) constructor
        Assertion: ...This constructor will use null as the value of the algorithm parameters.
        Test preconditions: test object created using ctor which takes algorithm name and encrypted data as a parameters
        Expected: null must be returned
        Throws:
        IOException
      • testGetAlgParameters04

        public final void testGetAlgParameters04()
                                          throws IOException
        Test #4 for getAlgParameters() method
        Assertion: returns the algorithm parameters
        Test preconditions: test object created using ctor which takes AlgorithmParameters and encrypted data as a parameters;
        Expected: the same algorithm parameters as ones passed to the ctor must be returned
        Throws:
        IOException
      • testGetEncryptedData01

        public final void testGetEncryptedData01()
                                          throws IOException
        Test #1 for getEncryptedData() method
        Assertion: returns the encrypted data
        Test preconditions: test object created using ctor which takes encoded form as the only parameter; encoded form passed contains encrypted data
        Expected: the equivalent encrypted data must be returned
        Throws:
        IOException
      • testGetEncryptedData02

        public final void testGetEncryptedData02()
        Test #2 for getEncryptedData() method
        Assertion: returns the encrypted data
        Test preconditions: test object created using ctor which takes algorithm name and encrypted data as a parameters
        Expected: the equivalent encrypted data must be returned
      • testGetEncryptedData03

        public final void testGetEncryptedData03()
                                          throws IOException
        Test #3 for getEncryptedData() method
        Assertion: returns the encrypted data
        Test preconditions: test object created using ctor which takes algorithm parameters and encrypted data as a parameters
        Expected: the equivalent encrypted data must be returned
        Throws:
        IOException
      • testGetEncryptedData04

        public final void testGetEncryptedData04()
        Test #4 for getEncryptedData() method
        Assertion: returns a new array each time this method is called
        Test preconditions: test object created using ctor which takes algorithm name and encrypted data as a parameters
        Expected: refs to encrypted data byte array passed to the ctor and returned by the method under test must be different
      • testGetEncoded01

        public final void testGetEncoded01()
                                    throws IOException
        Test #1 for getEncoded() method
        Assertion: returns the ASN.1 encoding of this object
        Test preconditions: test object created using ctor which takes encoded form as the only parameter
        Expected: equivalent encoded form must be returned
        Throws:
        IOException
      • testGetEncoded02

        public final void testGetEncoded02()
                                    throws IOException
        Test #2 for getEncoded() method
        Assertion: returns the ASN.1 encoding of this object
        Test preconditions: test object created using ctor which takes algorithm name and encrypted data as a parameters
        Expected: equivalent encoded form (without alg params) must be returned
        Throws:
        IOException
      • testGetEncoded03

        public final void testGetEncoded03()
                                    throws IOException
        Test #3 for getEncoded() method
        Assertion: returns the ASN.1 encoding of this object
        Test preconditions: test object created using ctor which takes algorithm name and encrypted data as a parameters
        Expected: equivalent encoded form (without alg params) must be returned
        Throws:
        IOException
      • testGetEncoded04

        public final void testGetEncoded04()
                                    throws IOException
        Test #4 for getEncoded() method
        Assertion: returns a new array each time this method is called
        Test preconditions: test object created using ctor which takes algorithm name and encrypted data as a parameters
        Expected: several refs to byte array returned by the method under test must be different
        Throws:
        IOException
      • testGetKeySpecCipher01

        public final void testGetKeySpecCipher01()
      • test_ROUNDTRIP_GetKeySpecCipher01

        public final void test_ROUNDTRIP_GetKeySpecCipher01()
        Encrypted data contains valid PKCS8 key info encoding
      • test_ROUNDTRIP_GetKeySpecCipher02

        public final void test_ROUNDTRIP_GetKeySpecCipher02()
        Encrypted data contains invalid PKCS8 key info encoding
      • testGetKeySpecKey01

        public final void testGetKeySpecKey01()
      • test_ROUNDTRIP_GetKeySpecKey01

        public final void test_ROUNDTRIP_GetKeySpecKey01()
        Encrypted data contains valid PKCS8 key info encoding
      • test_ROUNDTRIP_GetKeySpecKey02

        public final void test_ROUNDTRIP_GetKeySpecKey02()
        Encrypted data contains invalid PKCS8 key info encoding
      • testGetKeySpecKeyString01

        public final void testGetKeySpecKeyString01()
                                             throws Exception
        Throws:
        Exception
      • test_ROUNDTRIP_GetKeySpecKeyString01

        public final void test_ROUNDTRIP_GetKeySpecKeyString01()
                                                        throws Exception
        Encrypted data contains valid PKCS8 key info encoding
        Throws:
        Exception
      • test_ROUNDTRIP_GetKeySpecKeyString02

        public final void test_ROUNDTRIP_GetKeySpecKeyString02()
                                                        throws Exception
        Encrypted data contains invalid PKCS8 key info encoding
        Throws:
        Exception
      • testGetKeySpecKeyProvider01

        public final void testGetKeySpecKeyProvider01()
                                               throws Exception
        Throws:
        Exception
      • test_ROUNDTRIP_GetKeySpecKeyProvider01

        public final void test_ROUNDTRIP_GetKeySpecKeyProvider01()
        Encrypted data contains valid PKCS8 key info encoding
      • test_ROUNDTRIP_GetKeySpecKeyProvider02

        public final void test_ROUNDTRIP_GetKeySpecKeyProvider02()
        Encrypted data contains invalid PKCS8 key info encoding


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 111 / 158778125. Delta: 0.05651 с