本文整理汇总了Java中org.bouncycastle.crypto.params.ParametersWithSalt类的典型用法代码示例。如果您正苦于以下问题:Java ParametersWithSalt类的具体用法?Java ParametersWithSalt怎么用?Java ParametersWithSalt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParametersWithSalt类属于org.bouncycastle.crypto.params包,在下文中一共展示了ParametersWithSalt类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doTest6
import org.bouncycastle.crypto.params.ParametersWithSalt; //导入依赖的package包/类
public void doTest6()
throws Exception
{
byte[] salt = Hex.decode("61DF870C4890FE85D6E3DD87C3DCE3723F91DB49");
RSAKeyParameters pubParameters = new RSAKeyParameters(false, mod6, pub6);
RSAKeyParameters privParameters = new RSAKeyParameters(true, mod6, pri6);
ParametersWithSalt sigParameters = new ParametersWithSalt(privParameters, salt);
RSAEngine rsa = new RSAEngine();
byte[] data;
//
// ISO 9796-2 - PSS Signing
//
ISO9796d2PSSSigner eng = new ISO9796d2PSSSigner(rsa, new RIPEMD160Digest(), 20, true);
eng.init(true, sigParameters);
data = eng.generateSignature();
if (eng.getRecoveredMessage().length != 0)
{
fail("failed zero check");
}
eng.init(false, pubParameters);
if (!isSameAs(sig6, 1, data))
{
fail("failed ISO9796-2 generation Test 6");
}
if (!eng.verifySignature(data))
{
fail("failed ISO9796-2 verify Test 6");
}
}
示例2: doTest8
import org.bouncycastle.crypto.params.ParametersWithSalt; //导入依赖的package包/类
public void doTest8()
throws Exception
{
byte[] salt = Hex.decode("78E293203CBA1B7F92F05F4D171FF8CA3E738FF8");
RSAKeyParameters pubParameters = new RSAKeyParameters(false, mod6, pub6);
RSAKeyParameters privParameters = new RSAKeyParameters(true, mod6, pri6);
ParametersWithSalt sigParameters = new ParametersWithSalt(privParameters, salt);
RSAEngine rsa = new RSAEngine();
byte[] data;
//
// ISO 9796-2 - PSS Signing
//
ISO9796d2PSSSigner eng = new ISO9796d2PSSSigner(rsa, new RIPEMD160Digest(), 20, false);
eng.init(true, sigParameters);
eng.update(msg8[0]);
eng.update(msg8, 1, msg8.length - 1);
data = eng.generateSignature();
eng.init(false, pubParameters);
if (!isSameAs(sig8, 0, data))
{
fail("failed ISO9796-2 generation Test 8");
}
eng.update(msg8[0]);
eng.update(msg8, 1, msg8.length - 1);
if (!eng.verifySignature(sig8))
{
fail("failed ISO9796-2 verify Test 8");
}
}
示例3: doTest6
import org.bouncycastle.crypto.params.ParametersWithSalt; //导入依赖的package包/类
public void doTest6()
throws Exception
{
byte[] salt = Hex.decode("61DF870C4890FE85D6E3DD87C3DCE3723F91DB49");
RSAKeyParameters pubParameters = new RSAKeyParameters(false, mod6, pub6);
RSAKeyParameters privParameters = new RSAKeyParameters(true, mod6, pri6);
ParametersWithSalt sigParameters = new ParametersWithSalt(privParameters, salt);
RSAEngine rsa = new RSAEngine();
byte[] data;
//
// ISO 9796-2 - PSS Signing
//
ISO9796d2PSSSigner eng = new ISO9796d2PSSSigner(rsa, new RIPEMD160Digest(), 20, true);
eng.init(true, sigParameters);
data = eng.generateSignature();
eng.init(false, pubParameters);
if (!isSameAs(sig6, 1, data))
{
fail("failed ISO9796-2 generation Test 6");
}
if (!eng.verifySignature(data))
{
fail("failed ISO9796-2 verify Test 6");
}
}
示例4: doTest7
import org.bouncycastle.crypto.params.ParametersWithSalt; //导入依赖的package包/类
public void doTest7()
throws Exception
{
byte[] salt = new byte[0];
RSAKeyParameters pubParameters = new RSAKeyParameters(false, mod6, pub6);
RSAKeyParameters privParameters = new RSAKeyParameters(true, mod6, pri6);
ParametersWithSalt sigParameters = new ParametersWithSalt(privParameters, salt);
RSAEngine rsa = new RSAEngine();
byte[] data;
//
// ISO 9796-2 - PSS Signing
//
ISO9796d2PSSSigner eng = new ISO9796d2PSSSigner(rsa, new SHA1Digest(), 0, false);
eng.init(true, sigParameters);
eng.update(msg7[0]);
eng.update(msg7, 1, msg7.length - 1);
data = eng.generateSignature();
if (!eng.hasFullMessage())
{
fail("full message not detected");
}
byte[] recovered = new byte[eng.getRecoveredMessage().length];
System.arraycopy(eng.getRecoveredMessage(), 0, recovered, 0, recovered.length);
eng.init(false, pubParameters);
if (!isSameAs(sig7, 0, data))
{
fail("failed ISO9796-2 generation Test 7");
}
eng.update(msg7[0]);
eng.update(msg7, 1, msg7.length - 1);
if (!eng.verifySignature(sig7))
{
fail("failed ISO9796-2 verify Test 7");
}
if (!eng.hasFullMessage())
{
fail("full message not detected");
}
if (!isSameAs(msg7, 0, eng.getRecoveredMessage()))
{
fail("failed ISO9796-2 recovery Test 7");
}
if (!isSameAs(recovered, 0, eng.getRecoveredMessage()))
{
fail("failed ISO9796-2 recovery Test 7 recover");
}
}
示例5: doTest7
import org.bouncycastle.crypto.params.ParametersWithSalt; //导入依赖的package包/类
public void doTest7()
throws Exception
{
byte[] salt = new byte[0];
RSAKeyParameters pubParameters = new RSAKeyParameters(false, mod6, pub6);
RSAKeyParameters privParameters = new RSAKeyParameters(true, mod6, pri6);
ParametersWithSalt sigParameters = new ParametersWithSalt(privParameters, salt);
RSAEngine rsa = new RSAEngine();
byte[] data;
//
// ISO 9796-2 - PSS Signing
//
ISO9796d2PSSSigner eng = new ISO9796d2PSSSigner(rsa, new SHA1Digest(), 0, false);
eng.init(true, sigParameters);
eng.update(msg7[0]);
eng.update(msg7, 1, msg7.length - 1);
data = eng.generateSignature();
eng.init(false, pubParameters);
if (!isSameAs(sig7, 0, data))
{
fail("failed ISO9796-2 generation Test 7");
}
eng.update(msg7[0]);
eng.update(msg7, 1, msg7.length - 1);
if (!eng.verifySignature(sig7))
{
fail("failed ISO9796-2 verify Test 7");
}
if (!isSameAs(msg7, 0, eng.getRecoveredMessage()))
{
fail("failed ISO9796-2 recovery Test 7");
}
}