Java 类org.bouncycastle.crypto.encodings.ISO9796d1Encoding 实例源码

项目:gwt-crypto    文件:ISO9796Test.java   
private void doTest1()
    throws Exception
{
    RSAKeyParameters pubParameters = new RSAKeyParameters(false, mod1, pub1);
    RSAKeyParameters privParameters = new RSAKeyParameters(true, mod1, pri1);
    RSAEngine rsa = new RSAEngine();
    byte[] data;

    //
    // ISO 9796-1 - public encrypt, private decrypt
    //
    ISO9796d1Encoding eng = new ISO9796d1Encoding(rsa);

    eng.init(true, privParameters);

    eng.setPadBits(4);

    data = eng.processBlock(msg1, 0, msg1.length);

    eng.init(false, pubParameters);

    if (!areEqual(sig1, data))
    {
        fail("failed ISO9796-1 generation Test 1");
    }

    data = eng.processBlock(data, 0, data.length);

    if (!areEqual(msg1, data))
    {
        fail("failed ISO9796-1 retrieve Test 1");
    }
}
项目:gwt-crypto    文件:ISO9796Test.java   
private void doTest2()
    throws Exception
{
    RSAKeyParameters pubParameters = new RSAKeyParameters(false, mod1, pub1);
    RSAKeyParameters privParameters = new RSAKeyParameters(true, mod1, pri1);
    RSAEngine rsa = new RSAEngine();
    byte[] data;

    //
    // ISO 9796-1 - public encrypt, private decrypt
    //
    ISO9796d1Encoding eng = new ISO9796d1Encoding(rsa);

    eng.init(true, privParameters);

    data = eng.processBlock(msg2, 0, msg2.length);

    eng.init(false, pubParameters);

    if (!isSameAs(data, 1, sig2))
    {
        fail("failed ISO9796-1 generation Test 2");
    }

    data = eng.processBlock(data, 0, data.length);


    if (!areEqual(msg2, data))
    {
        fail("failed ISO9796-1 retrieve Test 2");
    }
}
项目:gwt-crypto    文件:ISO9796Test.java   
public void doTest3()
    throws Exception
{
    RSAKeyParameters pubParameters = new RSAKeyParameters(false, mod2, pub2);
    RSAKeyParameters privParameters = new RSAKeyParameters(true, mod2, pri2);
    RSAEngine rsa = new RSAEngine();
    byte[] data;

    //
    // ISO 9796-1 - public encrypt, private decrypt
    //
    ISO9796d1Encoding eng = new ISO9796d1Encoding(rsa);

    eng.init(true, privParameters);

    eng.setPadBits(4);

    data = eng.processBlock(msg3, 0, msg3.length);

    eng.init(false, pubParameters);

    if (!isSameAs(sig3, 1, data))
    {
        fail("failed ISO9796-1 generation Test 3");
    }

    data = eng.processBlock(data, 0, data.length);

    if (!isSameAs(msg3, 0, data))
    {
        fail("failed ISO9796-1 retrieve Test 3");
    }
}
项目:irma_future_id    文件:ISO9796Test.java   
private void doTest1()
    throws Exception
{
    RSAKeyParameters pubParameters = new RSAKeyParameters(false, mod1, pub1);
    RSAKeyParameters privParameters = new RSAKeyParameters(true, mod1, pri1);
    RSAEngine rsa = new RSAEngine();
    byte[] data;

    //
    // ISO 9796-1 - public encrypt, private decrypt
    //
    ISO9796d1Encoding eng = new ISO9796d1Encoding(rsa);

    eng.init(true, privParameters);

    eng.setPadBits(4);

    data = eng.processBlock(msg1, 0, msg1.length);

    eng.init(false, pubParameters);

    if (!areEqual(sig1, data))
    {
        fail("failed ISO9796-1 generation Test 1");
    }

    data = eng.processBlock(data, 0, data.length);

    if (!areEqual(msg1, data))
    {
        fail("failed ISO9796-1 retrieve Test 1");
    }
}
项目:irma_future_id    文件:ISO9796Test.java   
private void doTest2()
    throws Exception
{
    RSAKeyParameters pubParameters = new RSAKeyParameters(false, mod1, pub1);
    RSAKeyParameters privParameters = new RSAKeyParameters(true, mod1, pri1);
    RSAEngine rsa = new RSAEngine();
    byte[] data;

    //
    // ISO 9796-1 - public encrypt, private decrypt
    //
    ISO9796d1Encoding eng = new ISO9796d1Encoding(rsa);

    eng.init(true, privParameters);

    data = eng.processBlock(msg2, 0, msg2.length);

    eng.init(false, pubParameters);

    if (!isSameAs(data, 1, sig2))
    {
        fail("failed ISO9796-1 generation Test 2");
    }

    data = eng.processBlock(data, 0, data.length);


    if (!areEqual(msg2, data))
    {
        fail("failed ISO9796-1 retrieve Test 2");
    }
}
项目:irma_future_id    文件:ISO9796Test.java   
public void doTest3()
    throws Exception
{
    RSAKeyParameters pubParameters = new RSAKeyParameters(false, mod2, pub2);
    RSAKeyParameters privParameters = new RSAKeyParameters(true, mod2, pri2);
    RSAEngine rsa = new RSAEngine();
    byte[] data;

    //
    // ISO 9796-1 - public encrypt, private decrypt
    //
    ISO9796d1Encoding eng = new ISO9796d1Encoding(rsa);

    eng.init(true, privParameters);

    eng.setPadBits(4);

    data = eng.processBlock(msg3, 0, msg3.length);

    eng.init(false, pubParameters);

    if (!isSameAs(sig3, 1, data))
    {
        fail("failed ISO9796-1 generation Test 3");
    }

    data = eng.processBlock(data, 0, data.length);

    if (!isSameAs(msg3, 0, data))
    {
        fail("failed ISO9796-1 retrieve Test 3");
    }
}
项目:bc-java    文件:ISO9796Test.java   
private void doTest1()
    throws Exception
{
    RSAKeyParameters pubParameters = new RSAKeyParameters(false, mod1, pub1);
    RSAKeyParameters privParameters = new RSAKeyParameters(true, mod1, pri1);
    RSAEngine rsa = new RSAEngine();
    byte[] data;

    //
    // ISO 9796-1 - public encrypt, private decrypt
    //
    ISO9796d1Encoding eng = new ISO9796d1Encoding(rsa);

    eng.init(true, privParameters);

    eng.setPadBits(4);

    data = eng.processBlock(msg1, 0, msg1.length);

    eng.init(false, pubParameters);

    if (!areEqual(sig1, data))
    {
        fail("failed ISO9796-1 generation Test 1");
    }

    data = eng.processBlock(data, 0, data.length);

    if (!areEqual(msg1, data))
    {
        fail("failed ISO9796-1 retrieve Test 1");
    }
}
项目:bc-java    文件:ISO9796Test.java   
private void doTest2()
    throws Exception
{
    RSAKeyParameters pubParameters = new RSAKeyParameters(false, mod1, pub1);
    RSAKeyParameters privParameters = new RSAKeyParameters(true, mod1, pri1);
    RSAEngine rsa = new RSAEngine();
    byte[] data;

    //
    // ISO 9796-1 - public encrypt, private decrypt
    //
    ISO9796d1Encoding eng = new ISO9796d1Encoding(rsa);

    eng.init(true, privParameters);

    data = eng.processBlock(msg2, 0, msg2.length);

    eng.init(false, pubParameters);

    if (!isSameAs(data, 1, sig2))
    {
        fail("failed ISO9796-1 generation Test 2");
    }

    data = eng.processBlock(data, 0, data.length);


    if (!areEqual(msg2, data))
    {
        fail("failed ISO9796-1 retrieve Test 2");
    }
}
项目:bc-java    文件:ISO9796Test.java   
public void doTest3()
    throws Exception
{
    RSAKeyParameters pubParameters = new RSAKeyParameters(false, mod2, pub2);
    RSAKeyParameters privParameters = new RSAKeyParameters(true, mod2, pri2);
    RSAEngine rsa = new RSAEngine();
    byte[] data;

    //
    // ISO 9796-1 - public encrypt, private decrypt
    //
    ISO9796d1Encoding eng = new ISO9796d1Encoding(rsa);

    eng.init(true, privParameters);

    eng.setPadBits(4);

    data = eng.processBlock(msg3, 0, msg3.length);

    eng.init(false, pubParameters);

    if (!isSameAs(sig3, 1, data))
    {
        fail("failed ISO9796-1 generation Test 3");
    }

    data = eng.processBlock(data, 0, data.length);

    if (!isSameAs(msg3, 0, data))
    {
        fail("failed ISO9796-1 retrieve Test 3");
    }
}
项目:ipack    文件:CipherSpi.java   
public ISO9796d1Padding()
{
    super(new ISO9796d1Encoding(new RSABlindedEngine()));
}
项目:Aki-SSL    文件:CipherSpi.java   
public ISO9796d1Padding()
{
    super(new ISO9796d1Encoding(new RSABlindedEngine()));
}
项目:fast-rsa-engine    文件:FastCipherSpi.java   
public ISO9796d1Padding()
{
    super(new ISO9796d1Encoding(new NativeRSAEngine()));
}
项目:CryptMeme    文件:CipherSpi.java   
public ISO9796d1Padding()
{
    super(new ISO9796d1Encoding(new RSABlindedEngine()));
}
项目:irma_future_id    文件:CipherSpi.java   
public ISO9796d1Padding()
{
    super(new ISO9796d1Encoding(new RSABlindedEngine()));
}
项目:irma_future_id    文件:CipherSpi.java   
public ISO9796d1Padding()
{
    super(new ISO9796d1Encoding(new RSABlindedEngine()));
}
项目:bc-java    文件:CipherSpi.java   
public ISO9796d1Padding()
{
    super(new ISO9796d1Encoding(new RSABlindedEngine()));
}
项目:bc-java    文件:CipherSpi.java   
public ISO9796d1Padding()
{
    super(new ISO9796d1Encoding(new RSABlindedEngine()));
}