use of java.security.Provider in project robovm by robovm.
the class MessageDigest2Test method test_getDigestLength.
/**
* java.security.MessageDigest#getDigestLength()
*/
public void test_getDigestLength() throws Exception {
for (Entry<Provider, List<String>> e : digestAlgs.entrySet()) {
for (String algorithm : e.getValue()) {
MessageDigest md = MessageDigest.getInstance(algorithm, e.getKey().getName());
assertTrue("length not ok", md.getDigestLength() > 0);
}
}
}
use of java.security.Provider in project robovm by robovm.
the class MessageDigest2Test method test_clone.
/**
* java.security.MessageDigest#clone()
*/
public void test_clone() throws Exception {
for (Entry<Provider, List<String>> e : digestAlgs.entrySet()) {
for (String algorithm : e.getValue()) {
MessageDigest d1 = MessageDigest.getInstance(algorithm, e.getKey().getName());
for (byte b = 0; b < 84; b++) {
d1.update(b);
}
MessageDigest d2 = (MessageDigest) d1.clone();
d1.update((byte) 1);
d2.update((byte) 1);
assertTrue("cloned hash differs from original for algorithm " + algorithm, MessageDigest.isEqual(d1.digest(), d2.digest()));
}
}
}
use of java.security.Provider in project robovm by robovm.
the class ProviderTest method testProviderStringdoubleString.
/*
* Class under test for void Provider(String, double, String)
*/
public final void testProviderStringdoubleString() {
Provider p = new MyProvider("Provider name", 123.456, "Provider info");
assertEquals("Provider name", p.getName());
assertEquals(123.456, p.getVersion(), 0L);
assertEquals("Provider info", p.getInfo());
}
use of java.security.Provider in project robovm by robovm.
the class ProviderServiceTest method testSupportsParameter.
public void testSupportsParameter() {
Provider p = new MyProvider();
Provider.Service s1 = new Provider.Service(p, "type", "algorithm", "className", null, null);
assertTrue(s1.supportsParameter(null));
assertTrue(s1.supportsParameter(new Object()));
}
use of java.security.Provider in project robovm by robovm.
the class ProviderServiceTest method testToString.
public void testToString() {
Provider p = new MyProvider();
Provider.Service s1 = new Provider.Service(p, "type", "algorithm", "className", null, null);
s1.toString();
Provider.Service s2 = new Provider.Service(p, "SecureRandom", "algorithm", "tests.java.security.support.RandomImpl", null, null);
s2.toString();
}
Aggregations