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); }
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"); } } }
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); }
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); }
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) { } }
public GMAC() { super(new GMac(new GCMBlockCipher(new RC6Engine()))); }
public GMAC() { super(new GMac(new GCMBlockCipher(new SEEDEngine()))); }
public GMAC() { super(new GMac(new GCMBlockCipher(new TwofishEngine()))); }
public GMAC() { super(new GMac(new GCMBlockCipher(new NoekeonEngine()))); }
public GMAC() { super(new GMac(new GCMBlockCipher(new CamelliaEngine()))); }
public GMAC() { super(new GMac(new GCMBlockCipher(new CAST6Engine()))); }
public AESGMAC() { super(new GMac(new GCMBlockCipher(new AESFastEngine()))); }
public SerpentGMAC() { super(new GMac(new GCMBlockCipher(new SerpentEngine()))); }
public GMAC() { super(new GMac(new GCMBlockCipher(new SM4Engine()))); }
public TSerpentGMAC() { super(new GMac(new GCMBlockCipher(new TnepresEngine()))); }