use of dalvik.annotation.AndroidOnly in project robovm by robovm.
the class MessageDigestTestMD2 method testMessageDigest1.
@AndroidOnly("Android doesn't include MD2 message digest algorithm")
public void testMessageDigest1() throws Exception {
try {
MessageDigest digest = MessageDigest.getInstance("MD2");
fail("MD2 MessageDigest algorithm must not be supported");
} catch (NoSuchAlgorithmException e) {
// expected
}
try {
MessageDigest digest = MessageDigest.getInstance("1.2.840.113549.2.2");
fail("MD2 MessageDigest algorithm must not be supported");
} catch (NoSuchAlgorithmException e) {
// expected
}
}
use of dalvik.annotation.AndroidOnly in project robovm by robovm.
the class SignatureTestMD2withRSA method testSignature.
@AndroidOnly("Android doesn't include MD2withRSA signature algorithm")
public void testSignature() {
try {
Signature signature = Signature.getInstance("MD2withRSA");
fail("MD2withRSA for signature verification must not be supported");
} catch (NoSuchAlgorithmException e) {
// expected
}
try {
Signature signature = Signature.getInstance("MD2WithRSA");
fail("MD2withRSA for signature verification must not be supported");
} catch (NoSuchAlgorithmException e) {
// expected
}
try {
Signature signature = Signature.getInstance("MD2WITHRSA");
fail("MD2withRSA for signature verification must not be supported");
} catch (NoSuchAlgorithmException e) {
// expected
}
try {
Signature signature = Signature.getInstance("MD2withRSAEncryption");
fail("MD2withRSA for signature verification must not be supported");
} catch (NoSuchAlgorithmException e) {
// expected
}
try {
Signature signature = Signature.getInstance("MD2WithRSAEncryption");
fail("MD2withRSA for signature verification must not be supported");
} catch (NoSuchAlgorithmException e) {
// expected
}
try {
Signature signature = Signature.getInstance("MD2WITHRSAENCRYPTION");
fail("MD2withRSA for signature verification must not be supported");
} catch (NoSuchAlgorithmException e) {
// expected
}
try {
Signature signature = Signature.getInstance("MD2/RSA");
fail("MD2withRSA for signature verification must not be supported");
} catch (NoSuchAlgorithmException e) {
// expected
}
try {
Signature signature = Signature.getInstance("1.2.840.113549.1.1.2");
fail("MD2withRSA for signature verification must not be supported");
} catch (NoSuchAlgorithmException e) {
// expected
}
}
use of dalvik.annotation.AndroidOnly in project robovm by robovm.
the class SSLSocketTest method test_addHandshakeCompletedListener.
/**
* javax.net.ssl.SSLSocket#addHandshakeCompletedListener(HandshakeCompletedListener listener)
*/
@AndroidOnly("RI doesn't throw the specified IAE")
public void test_addHandshakeCompletedListener() throws IOException {
SSLSocket ssl = getSSLSocket();
HandshakeCompletedListener ls = new HandshakeCL();
try {
ssl.addHandshakeCompletedListener(null);
fail();
} catch (IllegalArgumentException expected) {
}
ssl.addHandshakeCompletedListener(ls);
ssl.close();
}
use of dalvik.annotation.AndroidOnly in project robovm by robovm.
the class X509CRLSelector2Test method testClone.
/**
* clone() method testing. Tests if the selector is cloned correctly: the
* crl which matche to the initial selector should match to the clone and
* the change of clone should not cause the change of initial selector.
*/
@AndroidOnly("Uses specific classes: " + "org.apache.harmony.security.asn1.ASN1OctetString, " + "org.apache.harmony.security.asn1.ASN1Integer.")
public void testClone() {
X509CRLSelector selector = new X509CRLSelector();
X500Principal iss1 = new X500Principal("O=First Org.");
X500Principal iss2 = new X500Principal("O=Second Org.");
X500Principal iss3 = new X500Principal("O=Third Org.");
BigInteger minCRL = new BigInteger("10000");
BigInteger maxCRL = new BigInteger("10000");
Date date = new Date(200);
selector.addIssuer(iss1);
selector.addIssuer(iss2);
selector.setMinCRLNumber(minCRL);
selector.setMaxCRLNumber(maxCRL);
selector.setDateAndTime(date);
X509CRLSelector clone = (X509CRLSelector) selector.clone();
TestCRL crl = new TestCRL(iss1);
crl.setCrlNumber(minCRL);
crl.setUpdateDates(new Date(200), new Date(200));
assertTrue("The specified CRL should match the clone selector.", selector.match(crl));
clone.addIssuer(iss3);
assertFalse("The changes of the clone selector should not cause " + "the changes of initial object", selector.getIssuerNames().size() == 3);
}
use of dalvik.annotation.AndroidOnly in project robovm by robovm.
the class X509CRLTest method testGetRevokedCertificate.
/**
* getRevokedCertificate(X509Certificate certificate) method testing.
* Check if the default implementation throws NullPointerException
* on null input data.
*/
@AndroidOnly("Test filed on RI: getRevokedCertificate throws " + "RuntimeException.")
public void testGetRevokedCertificate() {
try {
tbt_crl.getRevokedCertificate((X509Certificate) null);
fail("NullPointerException should be thrown " + "in the case of null input data.");
} catch (NullPointerException e) {
}
try {
CertificateFactory cf = CertificateFactory.getInstance("X.509");
X509Certificate cert = (X509Certificate) cf.generateCertificate(certArray);
tbt_crl.getRevokedCertificate(cert);
} catch (Exception e) {
fail("Unexpected exception: " + e);
}
}
Aggregations