Java 类org.bouncycastle.crypto.modes.gcm.Tables8kGCMMultiplier 实例源码

项目:gwt-crypto    文件:GCMTest.java   
private void runTestCase(String[] testVector, int macLength)
    throws InvalidCipherTextException
{
    int pos = 0;
    String testName = testVector[pos++];
    byte[] K = Hex.decode(testVector[pos++]);
    byte[] P = Hex.decode(testVector[pos++]);
    byte[] A = Hex.decode(testVector[pos++]);
    byte[] IV = Hex.decode(testVector[pos++]);
    byte[] C = Hex.decode(testVector[pos++]);

    // For short MAC, take leading bytes
    byte[] t = Hex.decode(testVector[pos++]);
    byte[] T = new byte[macLength];
    System.arraycopy(t, 0, T, 0, T.length);

    // Default multiplier
    runTestCase(null, null, testName, K, IV, A, P, C, T);

    runTestCase(new BasicGCMMultiplier(), new BasicGCMMultiplier(), testName, K, IV, A, P, C, T);
    runTestCase(new Tables8kGCMMultiplier(), new Tables8kGCMMultiplier(), testName, K, IV, A, P, C, T);
    runTestCase(new Tables64kGCMMultiplier(), new Tables64kGCMMultiplier(), testName, K, IV, A, P, C, T);
}
项目:irma_future_id    文件:GCMTest.java   
private void runTestCase(String[] testVector, int macLength)
    throws InvalidCipherTextException
{
    int pos = 0;
    String testName = testVector[pos++];
    byte[] K = Hex.decode(testVector[pos++]);
    byte[] P = Hex.decode(testVector[pos++]);
    byte[] A = Hex.decode(testVector[pos++]);
    byte[] IV = Hex.decode(testVector[pos++]);
    byte[] C = Hex.decode(testVector[pos++]);

    // For short MAC, take leading bytes
    byte[] t = Hex.decode(testVector[pos++]);
    byte[] T = new byte[macLength];
    System.arraycopy(t, 0, T, 0, T.length);

    // Default multiplier
    runTestCase(null, null, testName, K, IV, A, P, C, T);

    runTestCase(new BasicGCMMultiplier(), new BasicGCMMultiplier(), testName, K, IV, A, P, C, T);
    runTestCase(new Tables8kGCMMultiplier(), new Tables8kGCMMultiplier(), testName, K, IV, A, P, C, T);
    runTestCase(new Tables64kGCMMultiplier(), new Tables64kGCMMultiplier(), testName, K, IV, A, P, C, T);
}
项目:bc-java    文件:GCMTest.java   
private void runTestCase(String[] testVector, int macLength)
    throws InvalidCipherTextException
{
    int pos = 0;
    String testName = testVector[pos++];
    byte[] K = Hex.decode(testVector[pos++]);
    byte[] P = Hex.decode(testVector[pos++]);
    byte[] A = Hex.decode(testVector[pos++]);
    byte[] IV = Hex.decode(testVector[pos++]);
    byte[] C = Hex.decode(testVector[pos++]);

    // For short MAC, take leading bytes
    byte[] t = Hex.decode(testVector[pos++]);
    byte[] T = new byte[macLength];
    System.arraycopy(t, 0, T, 0, T.length);

    // Default multiplier
    runTestCase(null, null, testName, K, IV, A, P, C, T);

    runTestCase(new BasicGCMMultiplier(), new BasicGCMMultiplier(), testName, K, IV, A, P, C, T);
    runTestCase(new Tables8kGCMMultiplier(), new Tables8kGCMMultiplier(), testName, K, IV, A, P, C, T);
    runTestCase(new Tables64kGCMMultiplier(), new Tables64kGCMMultiplier(), testName, K, IV, A, P, C, T);
}
项目:gwt-crypto    文件:GCMTest.java   
private void randomTests()
    throws InvalidCipherTextException
{
    SecureRandom srng = new SecureRandom();
    srng.setSeed(Times.nanoTime());
    randomTests(srng, null);
    randomTests(srng, new BasicGCMMultiplier());
    randomTests(srng, new Tables8kGCMMultiplier());
    randomTests(srng, new Tables64kGCMMultiplier());
}
项目:irma_future_id    文件:GCMTest.java   
private void randomTests()
    throws InvalidCipherTextException
{
    SecureRandom srng = new SecureRandom();
    for (int i = 0; i < 10; ++i)
    {
        randomTest(srng, null); 
        randomTest(srng, new BasicGCMMultiplier()); 
        randomTest(srng, new Tables8kGCMMultiplier()); 
        randomTest(srng, new Tables64kGCMMultiplier()); 
    }
}
项目:bc-java    文件:GCMTest.java   
private void randomTests()
    throws InvalidCipherTextException
{
    SecureRandom srng = new SecureRandom();
    for (int i = 0; i < 10; ++i)
    {
        randomTest(srng, null); 
        randomTest(srng, new BasicGCMMultiplier()); 
        randomTest(srng, new Tables8kGCMMultiplier()); 
        randomTest(srng, new Tables64kGCMMultiplier()); 
    }
}