Package org.apache.harmony.crypto.tests.support

Examples of org.apache.harmony.crypto.tests.support.MyMacSpi


    /**
     * Test for <code>MacSpi</code> constructor
     * Assertion: constructs MacSpi
     */
    public void testMacSpiTests01() throws Exception {
        MacSpi mSpi = new MyMacSpi();
               
        byte [] bb1 = {(byte)1, (byte)2, (byte)3, (byte)4, (byte)5};
        SecretKeySpec sks = new SecretKeySpec(bb1, "SHA1");       
       
        assertEquals("Incorrect MacLength", mSpi.engineGetMacLength(), 0);
       
        try {
            mSpi.engineInit(null, null);           
            fail("IllegalArgumentException must be thrown");
        } catch (IllegalArgumentException e) {
        }

        mSpi.engineInit(sks, null);

        byte[] bb = mSpi.engineDoFinal();
        assertEquals(bb.length, 0);
        try {
            mSpi.clone();
            fail("CloneNotSupportedException was not thrown as expected");
        } catch (CloneNotSupportedException e) {
        }
       
        MacSpi mSpi1 = new MyMacSpi1();
View Full Code Here


            InvalidKeyException, InvalidAlgorithmParameterException {
        if (!DEFSupported) {
            fail(NotSupportedMsg);
            return;
        }
        MacSpi spi = new MyMacSpi();
        Mac mac = new myMac(spi, defaultProvider, defaultAlgorithm);
        assertEquals("Incorrect algorithm", mac.getAlgorithm(),
                defaultAlgorithm);
        assertEquals("Incorrect provider", mac.getProvider(), defaultProvider);
        try {
View Full Code Here

    /**
     * Test for <code>MacSpi</code> constructor
     * Assertion: constructs MacSpi
     */
    public void testMacSpiTests01() throws Exception {
        MacSpi mSpi = new MyMacSpi();
               
        byte [] bb1 = {(byte)1, (byte)2, (byte)3, (byte)4, (byte)5};
        SecretKeySpec sks = new SecretKeySpec(bb1, "SHA1");       
       
        assertEquals("Incorrect MacLength", mSpi.engineGetMacLength(), 0);
       
        try {
            mSpi.engineInit(null, null);           
            fail("IllegalArgumentException must be thrown");
        } catch (IllegalArgumentException e) {
        }

        mSpi.engineInit(sks, null);

        byte[] bb = mSpi.engineDoFinal();
        assertEquals(bb.length, 0);
        try {
            mSpi.clone();
            fail("CloneNotSupportedException was not thrown as expected");
        } catch (CloneNotSupportedException e) {
        }
       
        MacSpi mSpi1 = new MyMacSpi1();
View Full Code Here

            InvalidKeyException, InvalidAlgorithmParameterException {
        if (!DEFSupported) {
            fail(NotSupportedMsg);
            return;
        }
        MacSpi spi = new MyMacSpi();
        Mac mac = new myMac(spi, defaultProvider, defaultAlgorithm);
        assertEquals("Incorrect algorithm", mac.getAlgorithm(),
                defaultAlgorithm);
        assertEquals("Incorrect provider", mac.getProvider(), defaultProvider);
        try {
View Full Code Here

TOP

Related Classes of org.apache.harmony.crypto.tests.support.MyMacSpi

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.