/**
   * Constructor with optional validation.
   *
   * @param string the base string to wrap.
   * @param validate whether or not to check the string.
   * @throws IllegalArgumentException if validate is true and the string contains characters that
   *     should not be in a PrintableString.
   */
  public DERPrintableString(String string, boolean validate) {
    if (validate && !isPrintableString(string)) {
      throw new IllegalArgumentException("string contains illegal characters");
    }

    this.string = Strings.toByteArray(string);
  }
 public String getString() {
   return Strings.fromByteArray(string);
 }