예제 #1
0
 public byte[] getIV() {
   if (iv != null) {
     return iv.getOctets();
   } else {
     return null;
   }
 }
예제 #2
0
파일: ASN1Integer.java 프로젝트: jronal/dss
  /**
   * return an Integer from a tagged object.
   *
   * @param obj the tagged object holding the object we want
   * @param explicit true if the object is meant to be explicitly tagged false otherwise.
   * @throws IllegalArgumentException if the tagged object cannot be converted.
   * @return an ASN1Integer instance.
   */
  public static ASN1Integer getInstance(ASN1TaggedObject obj, boolean explicit) {
    ASN1Primitive o = obj.getObject();

    if (explicit || (o instanceof ASN1Integer)) {
      return getInstance(o);
    } else {
      return new ASN1Integer(ASN1OctetString.getInstance(obj.getObject()).getOctets());
    }
  }
예제 #3
0
  /**
   * return an Integer from a tagged object.
   *
   * @param obj the tagged object holding the object we want
   * @param explicit true if the object is meant to be explicitly tagged false otherwise.
   * @exception IllegalArgumentException if the tagged object cannot be converted.
   */
  public static DERInteger getInstance(ASN1TaggedObject obj, boolean explicit) {
    DERObject o = obj.getObject();

    if (explicit || o instanceof DERInteger) {
      return getInstance(o);
    } else {
      return new ASN1Integer(ASN1OctetString.getInstance(obj.getObject()).getOctets());
    }
  }
  /**
   * return a Printable String from a tagged object.
   *
   * @param obj the tagged object holding the object we want
   * @param explicit true if the object is meant to be explicitly tagged false otherwise.
   * @exception IllegalArgumentException if the tagged object cannot be converted.
   */
  public static DERPrintableString getInstance(ASN1TaggedObject obj, boolean explicit) {
    ASN1Primitive o = obj.getObject();

    if (explicit || o instanceof DERPrintableString) {
      return getInstance(o);
    } else {
      return new DERPrintableString(ASN1OctetString.getInstance(o).getOctets());
    }
  }