Java 类org.bouncycastle.crypto.macs.GMac 实例源码

项目:gwt-crypto    文件:GMacTest.java   
public void performTest()
{
    for (int i = 0; i < TEST_VECTORS.length; i++)
    {
        TestCase testCase = TEST_VECTORS[i];

        Mac mac = new GMac(new GCMBlockCipher(new AESFastEngine()), testCase.getTag().length * 8);
        CipherParameters key = new KeyParameter(testCase.getKey());
        mac.init(new ParametersWithIV(key, testCase.getIv()));

        testSingleByte(mac, testCase);
        testMultibyte(mac, testCase);
    }

    // Invalid mac size
    testInvalidMacSize(97);
    testInvalidMacSize(136);
    testInvalidMacSize(24);
}
项目:gwt-crypto    文件:GMacTest.java   
private void testInvalidMacSize(int size)
{
    try
    {
        GMac mac = new GMac(new GCMBlockCipher(new AESFastEngine()), size);
        mac.init(new ParametersWithIV(null, new byte[16]));
        fail("Expected failure for illegal mac size " + size);
    }
    catch (IllegalArgumentException e)
    {
        if (!e.getMessage().startsWith("Invalid value for MAC size"))
        {
            fail("Illegal mac size failed with unexpected message");
        }
    }
}
项目:irma_future_id    文件:GMacTest.java   
public void performTest()
{
    for (int i = 0; i < TEST_VECTORS.length; i++)
    {
        TestCase testCase = TEST_VECTORS[i];

        Mac mac = new GMac(new GCMBlockCipher(new AESFastEngine()), testCase.getTag().length * 8);
        CipherParameters key = new KeyParameter(testCase.getKey());
        mac.init(new ParametersWithIV(key, testCase.getIv()));

        testSingleByte(mac, testCase);
        testMultibyte(mac, testCase);
    }

    // Invalid mac size
    testInvalidMacSize(97);
    testInvalidMacSize(136);
    testInvalidMacSize(88);
    testInvalidMacSize(64);
}
项目:bc-java    文件:GMacTest.java   
public void performTest()
{
    for (int i = 0; i < TEST_VECTORS.length; i++)
    {
        TestCase testCase = TEST_VECTORS[i];

        Mac mac = new GMac(new GCMBlockCipher(new AESFastEngine()), testCase.getTag().length * 8);
        CipherParameters key = new KeyParameter(testCase.getKey());
        mac.init(new ParametersWithIV(key, testCase.getIv()));

        testSingleByte(mac, testCase);
        testMultibyte(mac, testCase);
    }

    // Invalid mac size
    testInvalidMacSize(97);
    testInvalidMacSize(136);
    testInvalidMacSize(88);
    testInvalidMacSize(64);
}
项目:irma_future_id    文件:MacThroughputTest.java   
public static void main(String[] args)
{
    testMac(new HMac(new SHA1Digest()), new KeyParameter(generateNonce(20)), 3);
    testMac(new SkeinMac(SkeinMac.SKEIN_512, 128), new KeyParameter(generateNonce(64)), 2);
    testMac(new SipHash(), new KeyParameter(generateNonce(16)), 1);
    testMac(new CMac(new AESFastEngine()), new KeyParameter(generateNonce(16)), 3);
    testMac(new GMac(new GCMBlockCipher(new AESFastEngine())), new ParametersWithIV(new KeyParameter(
            generateNonce(16)), generateNonce(16)), 5);
    testMac(new Poly1305(new NullEngine(16)), new ParametersWithIV(generatePoly1305Key(), generateNonce(16)), 1);
    testMac(new Poly1305(new AESFastEngine()), new ParametersWithIV(generatePoly1305Key(), generateNonce(16)), 1);
    testMac(new Poly1305Reference(new NullEngine(16)), new ParametersWithIV(generatePoly1305Key(),
            generateNonce(16)), 1);
}
项目:irma_future_id    文件:GMacTest.java   
private void testInvalidMacSize(int size)
{
    try
    {
        GMac mac = new GMac(new GCMBlockCipher(new AESFastEngine()), size);
        mac.init(new ParametersWithIV(null, new byte[16]));
        fail("Expected failure for illegal mac size " + size);
    }
    catch (IllegalArgumentException e)
    {
    }
}
项目:bc-java    文件:GMacTest.java   
private void testInvalidMacSize(int size)
{
    try
    {
        GMac mac = new GMac(new GCMBlockCipher(new AESFastEngine()), size);
        mac.init(new ParametersWithIV(null, new byte[16]));
        fail("Expected failure for illegal mac size " + size);
    }
    catch (IllegalArgumentException e)
    {
    }
}
项目:ipack    文件:RC6.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new RC6Engine())));
}
项目:ipack    文件:SEED.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new SEEDEngine())));
}
项目:ipack    文件:Twofish.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new TwofishEngine())));
}
项目:ipack    文件:Noekeon.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new NoekeonEngine())));
}
项目:ipack    文件:Camellia.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new CamelliaEngine())));
}
项目:ipack    文件:CAST6.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new CAST6Engine())));
}
项目:ipack    文件:AES.java   
public AESGMAC()
{
    super(new GMac(new GCMBlockCipher(new AESFastEngine())));
}
项目:ipack    文件:Serpent.java   
public SerpentGMAC()
{
    super(new GMac(new GCMBlockCipher(new SerpentEngine())));
}
项目:Aki-SSL    文件:RC6.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new RC6Engine())));
}
项目:Aki-SSL    文件:SEED.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new SEEDEngine())));
}
项目:Aki-SSL    文件:Twofish.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new TwofishEngine())));
}
项目:Aki-SSL    文件:SM4.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new SM4Engine())));
}
项目:Aki-SSL    文件:Noekeon.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new NoekeonEngine())));
}
项目:Aki-SSL    文件:Camellia.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new CamelliaEngine())));
}
项目:Aki-SSL    文件:CAST6.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new CAST6Engine())));
}
项目:Aki-SSL    文件:AES.java   
public AESGMAC()
{
    super(new GMac(new GCMBlockCipher(new AESFastEngine())));
}
项目:Aki-SSL    文件:Serpent.java   
public SerpentGMAC()
{
    super(new GMac(new GCMBlockCipher(new SerpentEngine())));
}
项目:Aki-SSL    文件:Serpent.java   
public TSerpentGMAC()
{
    super(new GMac(new GCMBlockCipher(new TnepresEngine())));
}
项目:CryptMeme    文件:RC6.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new RC6Engine())));
}
项目:CryptMeme    文件:SEED.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new SEEDEngine())));
}
项目:CryptMeme    文件:Twofish.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new TwofishEngine())));
}
项目:CryptMeme    文件:Noekeon.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new NoekeonEngine())));
}
项目:CryptMeme    文件:Camellia.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new CamelliaEngine())));
}
项目:CryptMeme    文件:CAST6.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new CAST6Engine())));
}
项目:CryptMeme    文件:AES.java   
public AESGMAC()
{
    super(new GMac(new GCMBlockCipher(new AESFastEngine())));
}
项目:CryptMeme    文件:Serpent.java   
public SerpentGMAC()
{
    super(new GMac(new GCMBlockCipher(new SerpentEngine())));
}
项目:irma_future_id    文件:RC6.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new RC6Engine())));
}
项目:irma_future_id    文件:SEED.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new SEEDEngine())));
}
项目:irma_future_id    文件:Twofish.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new TwofishEngine())));
}
项目:irma_future_id    文件:Noekeon.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new NoekeonEngine())));
}
项目:irma_future_id    文件:Camellia.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new CamelliaEngine())));
}
项目:irma_future_id    文件:CAST6.java   
public GMAC()
{
    super(new GMac(new GCMBlockCipher(new CAST6Engine())));
}
项目:irma_future_id    文件:AES.java   
public AESGMAC()
{
    super(new GMac(new GCMBlockCipher(new AESFastEngine())));
}