Search in sources :

Example 16 with ASN1Null

use of com.unboundid.asn1.ASN1Null in project ldapsdk by pingidentity.

the class DebugTestCase method testDebugASN1Write1DisabledAll.

/**
 * Tests the first {@code debugASN1Write} method with the debugger disabled
 * and a debug type set of all types.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testDebugASN1Write1DisabledAll() throws Exception {
    Debug.setEnabled(false);
    testLogHandler.resetMessageCount();
    assertFalse(Debug.debugEnabled(DebugType.ASN1));
    Debug.debugASN1Write(new ASN1Null());
    assertTrue(testLogHandler.getMessageCount() >= 0);
}
Also used : ASN1Null(com.unboundid.asn1.ASN1Null) Test(org.testng.annotations.Test)

Example 17 with ASN1Null

use of com.unboundid.asn1.ASN1Null in project ldapsdk by pingidentity.

the class DebugTestCase method testDebugASN1Read2EnabledWithoutASN1.

/**
 * Tests the second {@code debugASN1Read} method with the debugger enabled
 * and a debug type set that does not include the ASN.1 type.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testDebugASN1Read2EnabledWithoutASN1() throws Exception {
    Debug.setEnabled(true, EnumSet.of(DebugType.OTHER));
    testLogHandler.resetMessageCount();
    assertFalse(Debug.debugEnabled(DebugType.ASN1));
    Debug.debugASN1Read(Level.FINEST, new ASN1Null());
    assertTrue(testLogHandler.getMessageCount() >= 0);
}
Also used : ASN1Null(com.unboundid.asn1.ASN1Null) Test(org.testng.annotations.Test)

Example 18 with ASN1Null

use of com.unboundid.asn1.ASN1Null in project ldapsdk by pingidentity.

the class DebugTestCase method testDebugASN1Read1DisabledAll.

/**
 * Tests the first {@code debugASN1Read} method with the debugger disabled
 * and a debug type set of all types.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testDebugASN1Read1DisabledAll() throws Exception {
    Debug.setEnabled(false);
    testLogHandler.resetMessageCount();
    assertFalse(Debug.debugEnabled(DebugType.ASN1));
    Debug.debugASN1Read(new ASN1Null());
    assertTrue(testLogHandler.getMessageCount() >= 0);
}
Also used : ASN1Null(com.unboundid.asn1.ASN1Null) Test(org.testng.annotations.Test)

Example 19 with ASN1Null

use of com.unboundid.asn1.ASN1Null in project ldapsdk by pingidentity.

the class DebugTestCase method testDebugASN1Read2DisabledAll.

/**
 * Tests the second {@code debugASN1Read} method with the debugger disabled
 * and a debug type set of all types.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testDebugASN1Read2DisabledAll() throws Exception {
    Debug.setEnabled(false);
    testLogHandler.resetMessageCount();
    assertFalse(Debug.debugEnabled(DebugType.ASN1));
    Debug.debugASN1Read(Level.FINEST, new ASN1Null());
    assertTrue(testLogHandler.getMessageCount() >= 0);
}
Also used : ASN1Null(com.unboundid.asn1.ASN1Null) Test(org.testng.annotations.Test)

Example 20 with ASN1Null

use of com.unboundid.asn1.ASN1Null in project ldapsdk by pingidentity.

the class X509CertificateTestCase method testIsSelfSignedWithDifferentAuthorityAndSubjectKeyIdentifiers.

/**
 * Tests the {@code isSelfSigned} method for a certificate that has both
 * subject key identifier and authority key identifier extensions with
 * different values.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testIsSelfSignedWithDifferentAuthorityAndSubjectKeyIdentifiers() throws Exception {
    final X509Certificate c = new X509Certificate(X509CertificateVersion.V3, BigInteger.valueOf(12345L), SignatureAlgorithmIdentifier.SHA_256_WITH_RSA.getOID(), new ASN1Null(), new ASN1BitString(true, false, true, false, true), new DN("CN=Test,O=Example Corporation,C=US"), System.currentTimeMillis(), System.currentTimeMillis() + (365L * 86_400_000L), new DN("CN=Test,O=Example Corporation,C=US"), PublicKeyAlgorithmIdentifier.RSA.getOID(), new ASN1Null(), new ASN1BitString(false, true, false, true, false), null, null, null, new SubjectKeyIdentifierExtension(false, new ASN1OctetString("keyIdentifier")), new AuthorityKeyIdentifierExtension(false, new ASN1OctetString("differentKeyIdentifier"), null, null));
    assertFalse(c.isSelfSigned());
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) DN(com.unboundid.ldap.sdk.DN) ASN1BitString(com.unboundid.asn1.ASN1BitString) ASN1Null(com.unboundid.asn1.ASN1Null) Test(org.testng.annotations.Test)

Aggregations

ASN1Null (com.unboundid.asn1.ASN1Null)69 Test (org.testng.annotations.Test)65 ASN1BitString (com.unboundid.asn1.ASN1BitString)36 ASN1OctetString (com.unboundid.asn1.ASN1OctetString)33 DN (com.unboundid.ldap.sdk.DN)33 OID (com.unboundid.util.OID)32 ASN1Sequence (com.unboundid.asn1.ASN1Sequence)28 ASN1ObjectIdentifier (com.unboundid.asn1.ASN1ObjectIdentifier)23 ASN1Integer (com.unboundid.asn1.ASN1Integer)21 ASN1Element (com.unboundid.asn1.ASN1Element)20 ASN1BigInteger (com.unboundid.asn1.ASN1BigInteger)15 ASN1GeneralizedTime (com.unboundid.asn1.ASN1GeneralizedTime)9 ASN1UTCTime (com.unboundid.asn1.ASN1UTCTime)6 ArrayList (java.util.ArrayList)6 ASN1Null (com.github.zhenwei.core.asn1.ASN1Null)5 Date (java.util.Date)5 ASN1ObjectIdentifier (com.github.zhenwei.core.asn1.ASN1ObjectIdentifier)3 ASN1OctetString (com.github.zhenwei.core.asn1.ASN1OctetString)3 AlgorithmParameters (java.security.AlgorithmParameters)3 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)3