/** Tests the <CODE>write/readOctetString</CODE> methods. */
  @Test(dataProvider = "stringValues")
  public void testEncodeDecodeOctetString(final String s) throws Exception {
    getWriter().writeOctetString(s);

    final String expected = s != null ? s : "";
    final ASN1Reader r = getReader(getEncodedBytes());
    assertEquals(r.peekLength(), StaticUtils.getBytes(expected).length);
    assertEquals(r.peekType(), ASN1.UNIVERSAL_OCTET_STRING_TYPE);
    assertEquals(r.readOctetStringAsString(), expected);
  }
  /** Tests the <CODE>write/readOctetString</CODE> methods. */
  @Test(dataProvider = "stringValues")
  public void testEncodeDecodeOctetStringType(final String s) throws Exception {
    for (final byte type : testTypes) {
      getWriter().writeOctetString(type, s);

      final String expected = s != null ? s : "";
      final ASN1Reader r = getReader(getEncodedBytes());
      assertEquals(r.peekLength(), StaticUtils.getBytes(expected).length);
      assertEquals(r.peekType(), type);
      assertEquals(r.readOctetStringAsString(), expected);
    }
  }
 @Override
 public byte[] getPassword() {
   // Defensive copy.
   return StaticUtils.copyOfBytes(impl.getPassword());
 }