use of org.apache.harmony.security.tests.support.cert.MyCertificate in project robovm by robovm.
the class CollectionCertStoreParametersTest method testClone02.
/**
* Test #2 for <code>clone()</code> method<br>
*/
public final void testClone02() {
Vector<Certificate> certificates = new Vector<Certificate>();
certificates.add(new MyCertificate("TEST", new byte[] { (byte) 4 }));
CollectionCertStoreParameters cp1 = new CollectionCertStoreParameters(certificates);
CollectionCertStoreParameters cp2 = (CollectionCertStoreParameters) cp1.clone();
// check that both objects hold the same reference
assertTrue(cp1.getCollection() == cp2.getCollection());
}
use of org.apache.harmony.security.tests.support.cert.MyCertificate in project robovm by robovm.
the class CertificateCertificateRepTest method testCertificateCertificateRep.
/**
* Test for
* <code>Certificate.CertificateRep(String type, byte[] data)</code>
* method<br>
*/
public final void testCertificateCertificateRep() {
MyCertificate c1 = new MyCertificate("TEST_TYPE", testEncoding);
MyCertificateRep rep = c1.new MyCertificateRep("TEST_TYPE", new byte[] { (byte) 1, (byte) 2, (byte) 3 });
assertTrue(Arrays.equals(new byte[] { (byte) 1, (byte) 2, (byte) 3 }, rep.getData()));
assertEquals("TEST_TYPE", rep.getType());
try {
c1.new MyCertificateRep(null, null);
} catch (Exception e) {
fail("Unexpected exeption " + e.getMessage());
}
try {
MyCertificate.MyCertificateRep rep1 = c1.new MyCertificateRep("X509", TestUtils.getX509Certificate_v3());
assertEquals("X509", rep1.getType());
assertTrue(Arrays.equals(TestUtils.getX509Certificate_v3(), rep1.getData()));
} catch (Exception e) {
fail("Unexpected exeption " + e.getMessage());
}
}
use of org.apache.harmony.security.tests.support.cert.MyCertificate in project robovm by robovm.
the class CollectionCertStoreParametersTest method testToString02.
/**
* Test #2 for <code>toString()</code> method<br>
*/
public final void testToString02() {
Vector<Certificate> certificates = new Vector<Certificate>();
certificates.add(new MyCertificate("TEST", new byte[] { (byte) 4 }));
CollectionCertStoreParameters cp = new CollectionCertStoreParameters(certificates);
assertNotNull(cp.toString());
}
use of org.apache.harmony.security.tests.support.cert.MyCertificate in project robovm by robovm.
the class CollectionCertStoreParametersTest method testCollectionCertStoreParametersCollection01.
/**
* Test #1 for <code>CollectionCertStoreParameters(Collection)</code>
* constructor<br>
*/
public final void testCollectionCertStoreParametersCollection01() {
Vector<Certificate> certificates = new Vector<Certificate>();
certificates.add(new MyCertificate("TEST", new byte[] {}));
new CollectionCertStoreParameters(certificates);
}
use of org.apache.harmony.security.tests.support.cert.MyCertificate in project robovm by robovm.
the class KSPrivateKeyEntryTest method createParams.
private void createParams(boolean diffCerts, boolean diffKeys) {
byte[] encoded = { (byte) 0, (byte) 1, (byte) 2, (byte) 3 };
testChain = new Certificate[5];
for (int i = 0; i < testChain.length; i++) {
String s = (diffCerts ? Integer.toString(i) : "NEW");
testChain[i] = new MyCertificate("MY_TEST_CERTIFICATE_".concat(s), encoded);
}
testPrivateKey = (diffKeys ? (PrivateKey) new tmpPrivateKey() : (PrivateKey) new tmpPrivateKey(testChain[0].getPublicKey().getAlgorithm()));
}
Aggregations