Search in sources :

Example 21 with MyCertificate

use of org.apache.harmony.security.tests.support.cert.MyCertificate in project robovm by robovm.

the class CertificateTest method testCertificate.

/**
     * Test for <code>Certificate(String type)</code> method<br>
     */
public final void testCertificate() throws Exception {
    Certificate c1 = new MyCertificate("TEST_TYPE", testEncoding);
    assertTrue(Arrays.equals(testEncoding, c1.getEncoded()));
    assertEquals("TEST", c1.getPublicKey().getAlgorithm());
    assertTrue(Arrays.equals(new byte[] { (byte) 1, (byte) 2, (byte) 3 }, c1.getPublicKey().getEncoded()));
    assertEquals("TEST_FORMAT", c1.getPublicKey().getFormat());
    assertEquals("TEST_TYPE", c1.getType());
}
Also used : MyCertificate(org.apache.harmony.security.tests.support.cert.MyCertificate) Certificate(java.security.cert.Certificate) MyCertificate(org.apache.harmony.security.tests.support.cert.MyCertificate) MyFailingCertificate(org.apache.harmony.security.tests.support.cert.MyFailingCertificate)

Example 22 with MyCertificate

use of org.apache.harmony.security.tests.support.cert.MyCertificate in project robovm by robovm.

the class CertificateTest method testGetType.

/**
     * Test for <code>getType()</code> method<br>
     * Assertion: returns this certificate type
     */
public final void testGetType() {
    Certificate c1 = new MyCertificate("TEST_TYPE", testEncoding);
    assertEquals("TEST_TYPE", c1.getType());
}
Also used : MyCertificate(org.apache.harmony.security.tests.support.cert.MyCertificate) Certificate(java.security.cert.Certificate) MyCertificate(org.apache.harmony.security.tests.support.cert.MyCertificate) MyFailingCertificate(org.apache.harmony.security.tests.support.cert.MyFailingCertificate)

Example 23 with MyCertificate

use of org.apache.harmony.security.tests.support.cert.MyCertificate in project robovm by robovm.

the class CertificateTest method testGetPublicKey.

/**
     * This test just calls <code>testGetPublicKey()</code> method<br>
     */
public final void testGetPublicKey() {
    Certificate c1 = new MyCertificate("TEST_TYPE", testEncoding);
    c1.getPublicKey();
}
Also used : MyCertificate(org.apache.harmony.security.tests.support.cert.MyCertificate) Certificate(java.security.cert.Certificate) MyCertificate(org.apache.harmony.security.tests.support.cert.MyCertificate) MyFailingCertificate(org.apache.harmony.security.tests.support.cert.MyFailingCertificate)

Example 24 with MyCertificate

use of org.apache.harmony.security.tests.support.cert.MyCertificate in project robovm by robovm.

the class CertificateTest method testEqualsObject04.

/**
     * Test for <code>equals(Object)</code> method<br>
     * Assertion: object not equals to other which is not
     * instance of <code>Certificate</code>
     */
public final void testEqualsObject04() {
    Certificate c1 = new MyCertificate("TEST_TYPE", testEncoding);
    assertFalse(c1.equals("TEST_TYPE"));
}
Also used : MyCertificate(org.apache.harmony.security.tests.support.cert.MyCertificate) Certificate(java.security.cert.Certificate) MyCertificate(org.apache.harmony.security.tests.support.cert.MyCertificate) MyFailingCertificate(org.apache.harmony.security.tests.support.cert.MyFailingCertificate)

Example 25 with MyCertificate

use of org.apache.harmony.security.tests.support.cert.MyCertificate in project robovm by robovm.

the class CertificateTest method testVerifyPublicKey.

/**
     * This test just calls <code>verify(PublicKey)</code> method<br>
     *
     * @throws InvalidKeyException
     * @throws CertificateException
     * @throws NoSuchAlgorithmException
     * @throws NoSuchProviderException
     * @throws SignatureException
     */
public final void testVerifyPublicKey() throws InvalidKeyException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException, SignatureException {
    Certificate c1 = new MyCertificate("TEST_TYPE", testEncoding);
    c1.verify(null);
}
Also used : MyCertificate(org.apache.harmony.security.tests.support.cert.MyCertificate) Certificate(java.security.cert.Certificate) MyCertificate(org.apache.harmony.security.tests.support.cert.MyCertificate) MyFailingCertificate(org.apache.harmony.security.tests.support.cert.MyFailingCertificate)

Aggregations

MyCertificate (org.apache.harmony.security.tests.support.cert.MyCertificate)32 Certificate (java.security.cert.Certificate)26 MyFailingCertificate (org.apache.harmony.security.tests.support.cert.MyFailingCertificate)15 Vector (java.util.Vector)6 CollectionCertStoreParameters (java.security.cert.CollectionCertStoreParameters)5 ObjectStreamException (java.io.ObjectStreamException)4 CertificateException (java.security.cert.CertificateException)4 KeyStore (java.security.KeyStore)3 CertificateFactory (java.security.cert.CertificateFactory)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 MyCertificateRep (org.apache.harmony.security.tests.support.cert.MyCertificate.MyCertificateRep)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 ObjectOutputStream (java.io.ObjectOutputStream)1 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)1 InvalidKeyException (java.security.InvalidKeyException)1 KeyStoreException (java.security.KeyStoreException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 NoSuchProviderException (java.security.NoSuchProviderException)1 PrivateKey (java.security.PrivateKey)1