Package org.apache.harmony.security.tests.support

Examples of org.apache.harmony.security.tests.support.MySignature1


  /*
   * Class under test for Object clone()
   */
  public void testClone() {
    MySignature1 s = new MySignature1("ABC");
    try {
      s.clone();
      fail("No expected CloneNotSupportedException");
    } catch (CloneNotSupportedException e) { 
    } 
  }
View Full Code Here


    } catch (CloneNotSupportedException e) { 
    } 
  }

  public void testGetProvider() {
    MySignature1 s = new MySignature1("ABC");
   
        assertEquals("state", Signature.UNINITIALIZED, s.getState());
        assertNull("provider", s.getProvider());
  }
View Full Code Here

        assertEquals("state", Signature.UNINITIALIZED, s.getState());
        assertNull("provider", s.getProvider());
  }

  public void testGetAlgorithm() {
    MySignature1 s = new MySignature1("ABC");

        assertEquals("state", Signature.UNINITIALIZED, s.getState());
        assertEquals("algorithm", "ABC", s.getAlgorithm());
  }
View Full Code Here

  /*
   * Class under test for void initVerify(PublicKey)
   */
  public void testInitVerifyPublicKey() throws InvalidKeyException {
    MySignature1 s = new MySignature1("ABC");

        s.initVerify(new MyPublicKey());
        assertEquals("state", Signature.VERIFY, s.getState());
        assertTrue("initVerify() failed", s.runEngineInitVerify);
  }
View Full Code Here

  /*
   * Class under test for void initVerify(Certificate)
   */
  public void testInitVerifyCertificate() throws InvalidKeyException {
    MySignature1 s = new MySignature1("ABC");

        s.initVerify(new MyCertificate());
        assertEquals("state", Signature.VERIFY, s.getState());
        assertTrue("initVerify() failed", s.runEngineInitVerify);
  }
View Full Code Here

  /*
   * Class under test for void initSign(PrivateKey)
   */
  public void testInitSignPrivateKey() throws InvalidKeyException {
    MySignature1 s = new MySignature1("ABC");

        s.initSign(new MyPrivateKey());
        assertEquals("state", Signature.SIGN, s.getState());
        assertTrue("initSign() failed", s.runEngineInitSign);
  }
View Full Code Here

  /*
   * Class under test for void initSign(PrivateKey, SecureRandom)
   */
  public void testInitSignPrivateKeySecureRandom() throws InvalidKeyException {
    MySignature1 s = new MySignature1("ABC");

        s.initSign(new MyPrivateKey(), new SecureRandom());
        assertEquals("state", Signature.SIGN, s.getState());
        assertTrue("initSign() failed", s.runEngineInitSign);
  }
View Full Code Here

  /*
   * Class under test for byte[] sign()
   */
  public void testSign() throws Exception {
    MySignature1 s = new MySignature1("ABC");
    try {
      s.sign();
      fail("No expected SignatureException");
    } catch (SignatureException e) {   
    }

    s.initVerify(new MyPublicKey());
   
    try {
      s.sign();
      fail("No expected SignatureException");
    } catch (SignatureException e) {   
    }
   
    s.initSign(new MyPrivateKey());
        s.sign();
        assertEquals("state", Signature.SIGN, s.getState());
        assertTrue("sign() failed", s.runEngineSign);
  }
View Full Code Here

  /*
   * Class under test for boolean verify(byte[])
   */
  public void testVerifybyteArray() throws Exception {
    MySignature1 s = new MySignature1("ABC");
    byte[] b = {1, 2, 3, 4};
    try {
      s.verify(b);
      fail("No expected SignatureException");
    } catch (SignatureException e) {   
    }

    s.initSign(new MyPrivateKey());
    try {
      s.verify(b);
      fail("No expected SignatureException");
    } catch (SignatureException e) {   
    }
   
    s.initVerify(new MyPublicKey());
        s.verify(b);
        assertEquals("state", Signature.VERIFY, s.getState());
        assertTrue("verify() failed", s.runEngineVerify);
  }
View Full Code Here

  /*
   * Class under test for boolean verify(byte[], int, int)
   */
  public void testVerifybyteArrayintint() throws Exception {
    MySignature1 s = new MySignature1("ABC");
    byte[] b = {1, 2, 3, 4};
    try {
      s.verify(b, 0, 3);
      fail("No expected SignatureException");
    } catch (SignatureException e) {   
    }

    s.initSign(new MyPrivateKey());

        try {
      s.verify(b, 0, 3);
      fail("No expected SignatureException");
    } catch (SignatureException e) {   
    }
   
    s.initVerify(new MyPublicKey());
   
    try {
      s.verify(b, 0, 5);
      fail("No expected IllegalArgumentException");
    } catch (IllegalArgumentException e) {   
    }
   
    s.verify(b, 0, 3);
        assertEquals("state", Signature.VERIFY, s.getState());
        assertTrue("verify() failed", s.runEngineVerify);
  }
View Full Code Here

TOP

Related Classes of org.apache.harmony.security.tests.support.MySignature1

Copyright © 2018 www.massapicom. 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.