Examples of appendBERLength()


Examples of org.nasutekds.server.types.ByteStringBuilder.appendBERLength()

  public void testDecodeValidArrayAsOctetString(byte[] b)
      throws Exception
  {
    ByteStringBuilder bsb = new ByteStringBuilder();
    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendBERLength(b.length);
    bsb.append(b);

    assertEquals(getReader(bsb.toByteArray(), 0).readOctetString(),
        ByteString.wrap(b));
  }
View Full Code Here

Examples of org.nasutekds.server.types.ByteStringBuilder.appendBERLength()

  public void testDecodeValidArrayAsOctetStringAsString(byte[] b)
      throws Exception
  {
    ByteStringBuilder bsb = new ByteStringBuilder();
    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendBERLength(b.length);
    bsb.append(b);

    assertEquals(getReader(bsb.toByteArray(), 0).readOctetStringAsString(),
        new String(b, "UTF-8"));
  }
View Full Code Here

Examples of org.nasutekds.server.types.ByteStringBuilder.appendBERLength()

  public void testDecodeValidArrayAsOctetStringAsStringCharSet(byte[] b)
      throws Exception
  {
    ByteStringBuilder bsb = new ByteStringBuilder();
    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendBERLength(b.length);
    bsb.append(b);

    assertEquals(
        getReader(bsb.toByteArray(), 0).readOctetStringAsString("UTF-8"),
        new String(b, "UTF-8"));
View Full Code Here

Examples of org.nasutekds.server.types.ByteStringBuilder.appendBERLength()

  public void testDecodeValidArrayAsOctetStringBuilder(byte[] b)
      throws Exception
  {
    ByteStringBuilder bsb = new ByteStringBuilder();
    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendBERLength(b.length);
    bsb.append(b);

    ByteStringBuilder bsb2 = new ByteStringBuilder();
    getReader(bsb.toByteArray(), 0).readOctetString(bsb2);
    assertEquals(bsb2.toByteString(), ByteString.wrap(b));
View Full Code Here

Examples of org.nasutekds.server.types.ByteStringBuilder.appendBERLength()

  public void testDecodeValidArrayAsSequence(byte[] encodedElements)
      throws Exception
  {
    ByteStringBuilder bsb = new ByteStringBuilder();
    bsb.append(ASN1Constants.UNIVERSAL_SEQUENCE_TYPE);
    bsb.appendBERLength(encodedElements.length + 2);
    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendBERLength(encodedElements.length);
    bsb.append(encodedElements);

    ASN1Reader reader = getReader(bsb.toByteArray(), 0);
View Full Code Here

Examples of org.nasutekds.server.types.ByteStringBuilder.appendBERLength()

  {
    ByteStringBuilder bsb = new ByteStringBuilder();
    bsb.append(ASN1Constants.UNIVERSAL_SEQUENCE_TYPE);
    bsb.appendBERLength(encodedElements.length + 2);
    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendBERLength(encodedElements.length);
    bsb.append(encodedElements);

    ASN1Reader reader = getReader(bsb.toByteArray(), 0);
    assertEquals(reader.peekLength(), encodedElements.length + 2);
    reader.readStartSequence();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.