Java 类java.security.Signer 实例源码
项目:In-the-Box-Fork
文件:SignerTest.java
/**
* @tests java.security.Signer#toString()
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "toString",
args = {}
)
public void test_toString() throws Exception {
Signer s1 = new SignerStub("testToString1");
assertEquals("[Signer]testToString1", s1.toString());
Signer s2 = new SignerStub("testToString2", IdentityScope.getSystemScope());
s2.toString();
KeyPair kp = new KeyPair(new PublicKeyStub("public", "SignerTest.testToString", null),
new PrivateKeyStub("private", "SignerTest.testToString", null));
s1.setKeyPair(kp);
s1.toString();
s2.setKeyPair(kp);
s2.toString();
}
项目:In-the-Box-Fork
文件:SignerTest.java
/**
* verify Signer(String) creates instance
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "Signer",
args = {java.lang.String.class}
)
public void testSignerString() throws Exception {
Signer s = new SignerStub("sss3");
assertNotNull(s);
assertEquals("sss3", s.getName());
assertNull(s.getPrivateKey());
Signer s2 = new SignerStub(null);
assertNull(s2.getName());
}
项目:In-the-Box-Fork
文件:SignerTest.java
/**
* verify Signer.getPrivateKey() returns null or private key
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "",
method = "getPrivateKey",
args = {}
)
public void testGetPrivateKey() throws Exception {
byte [] privateKeyData = { 1, 2, 3, 4, 5};
PrivateKeyStub privateKey = new PrivateKeyStub("private", "fff", privateKeyData);
PublicKeyStub publicKey = new PublicKeyStub("public", "fff", null);
KeyPair kp = new KeyPair(publicKey, privateKey);
Signer s = new SignerStub("sss5");
assertNull(s.getPrivateKey());
s.setKeyPair(kp);
assertSame(privateKey, s.getPrivateKey());
}
项目:In-the-Box-Fork
文件:SignerTest.java
/**
* verify Signer() creates instance
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "Signer",
args = {}
)
public void testSigner() {
Signer s = new SignerStub();
assertNotNull(s);
//assertNull(s.getName(), s.getName());
assertNull(s.getPrivateKey());
}