Examples of NullCipher


Examples of javax.crypto.NullCipher

   * Class under test for byte[] update(byte[], int, int)
   */
  public void testUpdatebyteArrayintint2() {
      //Regression for HARMONY-758
        try {
            new NullCipher().update(new byte[1], 1, Integer.MAX_VALUE);
            fail("Expected IllegalArgumentException was not thrown");
        } catch (IllegalArgumentException e) {
        }
  }
View Full Code Here

Examples of javax.crypto.NullCipher

   * Class under test for int doFinal(byte[], int, int, byte[])
   */
  public void testDoFinalbyteArrayintintbyteArray2() throws Exception {
      //Regression for HARMONY-758
        try {
            new NullCipher().update(new byte[1], 1, Integer.MAX_VALUE,
                    new byte[1]);
            fail("Expected IllegalArgumentException was not thrown");
        } catch (IllegalArgumentException e) {
        }
  }
View Full Code Here

Examples of javax.crypto.NullCipher

   * Class under test for int doFinal(byte[], int, int, byte[])
   */
  public void testDoFinalbyteArrayintintbyteArray3() throws Exception {
      //Regression for HARMONY-758
        try {
            new NullCipher().update(new byte[1], 0, 1, new byte[0]);
            fail("Expected ArrayIndexOutOfBoundsException was not thrown");
        } catch (ArrayIndexOutOfBoundsException e) {
        }
  }
View Full Code Here

Examples of javax.crypto.NullCipher

   * Class under test for int doFinal(byte[], int, int, byte[], int)
   */
  public void testDoFinalbyteArrayintintbyteArrayint2() throws Exception {
      //Regression for HARMONY-758
        try {
            new NullCipher().update(new byte[1], 1, Integer.MAX_VALUE,
                    new byte[1], 0);
            fail("Expected IllegalArgumentException was not thrown");
        } catch (IllegalArgumentException e) {
        }
  }
View Full Code Here

Examples of javax.crypto.NullCipher

   * Class under test for int doFinal(byte[], int, int, byte[], int)
   */
  public void testDoFinalbyteArrayintintbyteArrayint3() throws Exception {
      //Regression for HARMONY-758
        try {
            new NullCipher().update(new byte[1], 0, 1,
                    new byte[0], 0);
            fail("Expected ArrayIndexOutOfBoundsException was not thrown");
        } catch (ArrayIndexOutOfBoundsException e) {
        }
  }
View Full Code Here

Examples of javax.crypto.NullCipher

    /**
     * @tests javax.crypto.CipherInputStream#read(byte[] b, int off, int len)
     */
    public void testReadBII() throws Exception {
        // Regression for HARMONY-1080
        CipherInputStream stream = new CipherInputStream(null, new NullCipher());
        try {
            stream.read(new byte[1], 1, 0);
            fail("NullPointerException expected");
        } catch (NullPointerException e) {
            // expected
View Full Code Here

Examples of javax.crypto.NullCipher

     * deserialized, the content od deserialized object equals to the
     * content of initial object.
     */
    public void testReadObject() throws Exception {
        String secret = "secret string";
        SealedObject so = new SealedObject(secret, new NullCipher());
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(bos);
        oos.writeObject(so);

        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(
                bos.toByteArray()));

        SealedObject so_des = (SealedObject) ois.readObject();
        assertEquals("The secret content of deserialized object "
                + "should be equal to the secret content of initial object",
                secret, so_des.getObject(new NullCipher()));
        assertEquals("The value returned by getAlgorithm() method of "
                + "deserialized object should be equal to the value returned "
                + "by getAlgorithm() method of initial object", so
                .getAlgorithm(), so_des.getAlgorithm());
    }
View Full Code Here

Examples of javax.crypto.NullCipher

                    + "of null SealedObject.");
        } catch (NullPointerException e) {
        }

        String secret = "secret string";
        Cipher cipher = new NullCipher();
        SealedObject so1 = new SealedObject(secret, cipher);
        SealedObject so2 = new SealedObject(so1);

        assertEquals("The secret content of the object should equals "
                + "to the secret content of initial object.", secret, so2
View Full Code Here

Examples of javax.crypto.NullCipher

     * with encryption algorithm and specified parameters can be retrieved by
     * specifying the initialized Cipher object.
     */
    public void testGetObject2() throws Exception {
        try {
            new SealedObject("secret string", new NullCipher())
                    .getObject((Cipher) null);
            fail("NullPointerException should be thrown in the case of "
                    + "null cipher.");
        } catch (NullPointerException e) {
        }
View Full Code Here

Examples of javax.crypto.NullCipher

     * object sealed with encryption algorithm can be retrieved by specifying
     * the cryptographic key and provider name.
     */
    public void testGetObject3() throws Exception {
        try {
            new SealedObject("secret string", new NullCipher()).getObject(
                    new SecretKeySpec(new byte[] { 0, 0, 0 }, "algorithm"),
                    null);
            fail("IllegalArgumentException should be thrown in the case of "
                    + "null provider.");
        } catch (IllegalArgumentException e) {
        }

        try {
            new SealedObject("secret string", new NullCipher()).getObject(
                    new SecretKeySpec(new byte[] { 0, 0, 0 }, "algorithm"), "");
            fail("IllegalArgumentException should be thrown in the case of "
                    + "empty provider.");
        } catch (IllegalArgumentException e) {
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.