Search in sources :

Example 16 with ASN1Boolean

use of com.github.zhenwei.core.asn1.ASN1Boolean in project ldapsdk by pingidentity.

the class UnboundIDExternallyProcessedAuthenticationBindRequestTestCase method testDecodeCredentialsMissingExternalMechanismName.

/**
 * Tests the behavior when trying to decode an ASN.1 element that represents
 * encoded credentials that would be valid except that it is missing the
 * required externalMechanismName element.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeCredentialsMissingExternalMechanismName() throws Exception {
    final ASN1Sequence credSequence = new ASN1Sequence(new ASN1OctetString((byte) 0x80, "dn:uid=test.user,ou=People,dc=example,dc=com"), new ASN1Boolean((byte) 0x82, true));
    UnboundIDExternallyProcessedAuthenticationBindRequest.decodeSASLCredentials(new ASN1OctetString(credSequence.encode()));
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Boolean(com.unboundid.asn1.ASN1Boolean) Test(org.testng.annotations.Test)

Example 17 with ASN1Boolean

use of com.github.zhenwei.core.asn1.ASN1Boolean in project ldapsdk by pingidentity.

the class AssuredReplicationResponseControlTestCase method testDecodeValueSequenceMalformedLocalLevel.

/**
 * Tests the behavior when trying to decode a control whose value sequence
 * contains a malformed local level.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeValueSequenceMalformedLocalLevel() throws Exception {
    final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1Enumerated((byte) 0x80, 1234), new ASN1Boolean((byte) 0x81, true), new ASN1Boolean((byte) 0x84, true));
    new AssuredReplicationResponseControl("1.3.6.1.4.1.30221.2.5.29", false, new ASN1OctetString(valueSequence.encode()));
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Enumerated(com.unboundid.asn1.ASN1Enumerated) ASN1Boolean(com.unboundid.asn1.ASN1Boolean) Test(org.testng.annotations.Test)

Example 18 with ASN1Boolean

use of com.github.zhenwei.core.asn1.ASN1Boolean in project ldapsdk by pingidentity.

the class AssuredReplicationResponseControlTestCase method testDecodeValueSequenceMalformedRemoteLevel.

/**
 * Tests the behavior when trying to decode a control whose value sequence
 * contains a malformed remote level.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeValueSequenceMalformedRemoteLevel() throws Exception {
    final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1Boolean((byte) 0x81, true), new ASN1Boolean((byte) 0x84, true), new ASN1Enumerated((byte) 0x83, 1234));
    new AssuredReplicationResponseControl("1.3.6.1.4.1.30221.2.5.29", false, new ASN1OctetString(valueSequence.encode()));
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Enumerated(com.unboundid.asn1.ASN1Enumerated) ASN1Boolean(com.unboundid.asn1.ASN1Boolean) Test(org.testng.annotations.Test)

Example 19 with ASN1Boolean

use of com.github.zhenwei.core.asn1.ASN1Boolean in project ldapsdk by pingidentity.

the class AssuredReplicationResponseControlTestCase method testDecodeValueSequenceMissingLocalSatisfied.

/**
 * Tests the behavior when trying to decode a control whose value sequence
 * does not include an element indicating whether the local assurance was
 * satisfied.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeValueSequenceMissingLocalSatisfied() throws Exception {
    final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1Boolean((byte) 0x84, true));
    new AssuredReplicationResponseControl("1.3.6.1.4.1.30221.2.5.29", false, new ASN1OctetString(valueSequence.encode()));
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Boolean(com.unboundid.asn1.ASN1Boolean) Test(org.testng.annotations.Test)

Example 20 with ASN1Boolean

use of com.github.zhenwei.core.asn1.ASN1Boolean in project ldapsdk by pingidentity.

the class AssuredReplicationResponseControlTestCase method testDecodeValueSequenceMissingRemoteSatisfied.

/**
 * Tests the behavior when trying to decode a control whose value sequence
 * does not include an element indicating whether the remote assurance was
 * satisfied.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeValueSequenceMissingRemoteSatisfied() throws Exception {
    final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1Boolean((byte) 0x81, true));
    new AssuredReplicationResponseControl("1.3.6.1.4.1.30221.2.5.29", false, new ASN1OctetString(valueSequence.encode()));
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Boolean(com.unboundid.asn1.ASN1Boolean) Test(org.testng.annotations.Test)

Aggregations

ASN1Boolean (com.unboundid.asn1.ASN1Boolean)51 ASN1OctetString (com.unboundid.asn1.ASN1OctetString)51 ASN1Sequence (com.unboundid.asn1.ASN1Sequence)51 ASN1Element (com.unboundid.asn1.ASN1Element)38 NotNull (com.unboundid.util.NotNull)32 ArrayList (java.util.ArrayList)32 ASN1Integer (com.unboundid.asn1.ASN1Integer)15 Test (org.testng.annotations.Test)14 ASN1Enumerated (com.unboundid.asn1.ASN1Enumerated)12 ASN1Boolean (com.github.zhenwei.core.asn1.ASN1Boolean)5 Nullable (com.unboundid.util.Nullable)5 IOException (java.io.IOException)5 ASN1Integer (com.github.zhenwei.core.asn1.ASN1Integer)4 ASN1Sequence (com.github.zhenwei.core.asn1.ASN1Sequence)4 ASN1TaggedObject (com.github.zhenwei.core.asn1.ASN1TaggedObject)4 ASN1Set (com.unboundid.asn1.ASN1Set)4 DERTaggedObject (com.github.zhenwei.core.asn1.DERTaggedObject)3 ASN1Long (com.unboundid.asn1.ASN1Long)3 Control (com.unboundid.ldap.sdk.Control)3 ASN1Boolean (org.bouncycastle.asn1.ASN1Boolean)3