Search in sources :

Example 91 with ASN1Sequence

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

the class IntermediateClientRequestValueTestCase method testDecodeInvalidType.

/**
 * Tests the {@code decode} method with an element containing an invalid type.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeInvalidType() throws Exception {
    ASN1Element[] elements = { new ASN1Element((byte) 0x00, new byte[0]) };
    IntermediateClientRequestValue.decode(new ASN1Sequence(elements));
}
Also used : ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Element(com.unboundid.asn1.ASN1Element) Test(org.testng.annotations.Test)

Example 92 with ASN1Sequence

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

the class IntermediateClientRequestValueTestCase method testDecodeInvalidDownstreamRequest.

/**
 * Tests the {@code decode} method with an element containing an invalid
 * downstream request.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeInvalidDownstreamRequest() throws Exception {
    ASN1Element[] downstreamElements = { new ASN1Element((byte) 0x00, new byte[0]) };
    ASN1Element[] elements = { new ASN1Sequence((byte) 0xA0, downstreamElements) };
    IntermediateClientRequestValue.decode(new ASN1Sequence(elements));
}
Also used : ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Element(com.unboundid.asn1.ASN1Element) Test(org.testng.annotations.Test)

Example 93 with ASN1Sequence

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

the class IntermediateClientResponseValueTestCase method testDecodeInvalidUpstreamResponse.

/**
 * Tests the {@code decode} method with an element containing an invalid
 * upstream response.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeInvalidUpstreamResponse() throws Exception {
    ASN1Element[] downstreamElements = { new ASN1Element((byte) 0x00, new byte[0]) };
    ASN1Element[] elements = { new ASN1Sequence((byte) 0xA0, downstreamElements) };
    IntermediateClientResponseValue.decode(new ASN1Sequence(elements));
}
Also used : ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Element(com.unboundid.asn1.ASN1Element) Test(org.testng.annotations.Test)

Example 94 with ASN1Sequence

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

the class IntermediateClientResponseValueTestCase method testDecodeInvalidUpstreamServerSecure.

/**
 * Tests the {@code decode} method with an element containing an invalid
 * upstream server secure value.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeInvalidUpstreamServerSecure() throws Exception {
    ASN1Element[] elements = { new ASN1Element((byte) 0x82, new byte[0]) };
    IntermediateClientResponseValue.decode(new ASN1Sequence(elements));
}
Also used : ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Element(com.unboundid.asn1.ASN1Element) Test(org.testng.annotations.Test)

Example 95 with ASN1Sequence

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

the class MatchingEntryCountRequestControlTestCase method testDecodeValueSequenceNegativeMaxCandidatesToExamine.

/**
 * Tests the behavior when trying to decode a control whose value sequence
 * includes a max candidates to examine element with a negative value.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeValueSequenceNegativeMaxCandidatesToExamine() throws Exception {
    final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1Integer((byte) 0x80, -1));
    new MatchingEntryCountRequestControl(new Control("1.3.6.1.4.1.30221.2.5.36", true, new ASN1OctetString(valueSequence.encode())));
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) Control(com.unboundid.ldap.sdk.Control) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Integer(com.unboundid.asn1.ASN1Integer) Test(org.testng.annotations.Test)

Aggregations

ASN1Sequence (com.unboundid.asn1.ASN1Sequence)455 ASN1OctetString (com.unboundid.asn1.ASN1OctetString)397 Test (org.testng.annotations.Test)311 ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)297 ASN1Element (com.unboundid.asn1.ASN1Element)231 ArrayList (java.util.ArrayList)184 IOException (java.io.IOException)141 NotNull (com.unboundid.util.NotNull)116 ASN1Enumerated (com.unboundid.asn1.ASN1Enumerated)95 ASN1Integer (com.unboundid.asn1.ASN1Integer)94 ASN1Sequence (com.github.zhenwei.core.asn1.ASN1Sequence)85 ASN1Encodable (org.bouncycastle.asn1.ASN1Encodable)76 ASN1InputStream (org.bouncycastle.asn1.ASN1InputStream)73 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)69 ASN1OctetString (org.bouncycastle.asn1.ASN1OctetString)64 ASN1Primitive (org.bouncycastle.asn1.ASN1Primitive)57 Enumeration (java.util.Enumeration)54 ASN1Boolean (com.unboundid.asn1.ASN1Boolean)53 X509Certificate (java.security.cert.X509Certificate)53 BigInteger (java.math.BigInteger)50