use of org.apache.harmony.security.tests.support.MySignature1 in project j2objc by google.
the class SignatureTest method testInitVerifyPublicKey.
/*
* Class under test for void initVerify(PublicKey)
*/
public void testInitVerifyPublicKey() throws InvalidKeyException {
MySignature1 s = new MySignature1("ABC");
s.initVerify(new MyPublicKey());
assertEquals("state", MySignature1.VERIFY, s.getState());
assertTrue("initVerify() failed", s.runEngineInitVerify);
try {
Signature sig = getTestSignature();
sig.initVerify((PublicKey) null);
} catch (InvalidKeyException e) {
// ok
} catch (NoSuchAlgorithmException e) {
fail("unexpected : " + e);
}
}
use of org.apache.harmony.security.tests.support.MySignature1 in project j2objc by google.
the class SignatureTest method testInitSignPrivateKeySecureRandom.
/*
* Class under test for void initSign(PrivateKey, SecureRandom)
*/
public void testInitSignPrivateKeySecureRandom() throws InvalidKeyException {
MySignature1 s = new MySignature1("ABC");
s.initSign(new MyPrivateKey(), new SecureRandom());
assertEquals("state", MySignature1.SIGN, s.getState());
assertTrue("initSign() failed", s.runEngineInitSign);
try {
Signature sig = getTestSignature();
sig.initSign(null, null);
fail("expected InvalidKeyException");
} catch (InvalidKeyException e) {
// ok
} catch (NoSuchAlgorithmException e) {
fail("unexpected : " + e);
}
}
use of org.apache.harmony.security.tests.support.MySignature1 in project j2objc by google.
the class SignatureTest method testSetParameterAlgorithmParameterSpec.
/*
* Class under test for void setParameter(AlgorithmParameterSpec)
*/
public void testSetParameterAlgorithmParameterSpec() throws InvalidAlgorithmParameterException {
MySignature1 s = new MySignature1("ABC");
try {
s.setParameter((java.security.spec.AlgorithmParameterSpec) null);
fail("No expected UnsupportedOperationException");
} catch (UnsupportedOperationException e) {
}
try {
Signature sig = getTestSignature();
sig.setParameter(new AlgorithmParameterSpec() {
});
} catch (InvalidAlgorithmParameterException e) {
fail("unexpected: " + e);
} catch (NoSuchAlgorithmException e) {
fail("unexpected: " + e);
}
}
use of org.apache.harmony.security.tests.support.MySignature1 in project j2objc by google.
the class SignatureTest method testGetAlgorithm.
public void testGetAlgorithm() {
MySignature1 s = new MySignature1("ABC");
assertEquals("state", MySignature1.UNINITIALIZED, s.getState());
assertEquals("algorithm", "ABC", s.getAlgorithm());
}
use of org.apache.harmony.security.tests.support.MySignature1 in project j2objc by google.
the class SignatureTest method testSetParameterStringObject.
/*
* Class under test for void setParameter(String, Object)
*/
@SuppressWarnings("deprecation")
public void testSetParameterStringObject() {
MySignature1 s = new MySignature1("ABC");
s.setParameter("aaa", new Object());
try {
Signature sig = getTestSignature();
sig.setParameter("TestParam", new Integer(42));
fail("expected InvalidParameterException");
} catch (InvalidParameterException e) {
// expected
} catch (NoSuchAlgorithmException e) {
fail("unexpected: " + e);
}
}
Aggregations