Examples of DERDecoder


Examples of codec.asn1.DERDecoder

     * extension did not contain a DER encoded ASN.1 type, the ASN1OctetString
     * containing the original value is returned.
     */
    public Object getValue() {
  ByteArrayInputStream bis;
  DERDecoder dec;
  ASN1Type res = null;

  try {
      bis = new ByteArrayInputStream(extnValue.getByteArray());
      dec = new DERDecoder(bis);
      res = dec.readType();
      dec.close();
  } catch (IOException e) {
      System.err.println("Internal error: shouldn't happen!");
      e.printStackTrace();
  } catch (ASN1Exception e) {
      res = extnValue;
View Full Code Here

Examples of codec.asn1.DERDecoder

     * template. This implicitly checks the syntax of the decoded type.
     */
    protected void decodeExtensionValue(ASN1Type t) throws ASN1Exception,
      IOException {
  ByteArrayInputStream bis;
  DERDecoder dec;

  if (t == null) {
      throw new NullPointerException("input parameter");
  }
  bis = new ByteArrayInputStream(extnValue.getByteArray());
  dec = new DERDecoder(bis);

  t.decode(dec);
  dec.close();
    }
View Full Code Here

Examples of codec.asn1.DERDecoder

     * @throws IOException DOCUMENT ME!
     */
    public void decode(byte[] encodedData) throws ASN1Exception, IOException
    {
        ByteArrayInputStream in;
        DERDecoder decoder;

        in          = new ByteArrayInputStream(encodedData);
        decoder     = new DERDecoder(in);

        this.decode(decoder);
        decoder.close();
    }
View Full Code Here

Examples of codec.asn1.DERDecoder

     * @throws IOException DOCUMENT ME!
     */
    public void decode(byte[] encodedData) throws ASN1Exception, IOException
    {
        ByteArrayInputStream in;
        DERDecoder decoder;

        in          = new ByteArrayInputStream(encodedData);
        decoder     = new DERDecoder(in);

        this.decode(decoder);
        decoder.close();
    }
View Full Code Here

Examples of codec.asn1.DERDecoder

     * @throws IOException DOCUMENT ME!
     */
    public void decode(byte[] encodedData) throws ASN1Exception, IOException
    {
        ByteArrayInputStream in;
        DERDecoder decoder;

        in          = new ByteArrayInputStream(encodedData);
        decoder     = new DERDecoder(in);

        this.decode(decoder);
        decoder.close();
    }
View Full Code Here

Examples of codec.asn1.DERDecoder

     *          null if the extension is not present
     */
    public int getBasicConstraints() {
  int res = -1;
  byte[] ext_value;
  DERDecoder dec;
  ByteArrayInputStream bais;
  ASN1Sequence seq;
  ASN1Integer pathLen;
  ASN1Boolean ca;

  String bc_oid = "2.5.29.19";

  // get the extension "basic constraints"
  ext_value = getExtensionValue(bc_oid);

  // is it present?
  if (ext_value != null) {

      // read the extension value through a byte array input stream
      bais = new ByteArrayInputStream(ext_value);

      try {

    // build outer sequence
    seq = new ASN1Sequence();

    ca = new ASN1Boolean();
    ca.setOptional(true);
    seq.add(ca);

    pathLen = new ASN1Integer();
    pathLen.setOptional(true);
    seq.add(pathLen);

    /*
     * Switched decoding to the correct way of doing it, which is to
     * take the ASN.1 object and to call its decode() method, rather
     * than calling readX() methods of the decoder. --volker roth
     */
    dec = new DERDecoder(bais);
    seq.decode(dec);
    bais.close();

    if (ca.isTrue()) {
        /*
 
View Full Code Here

Examples of codec.asn1.DERDecoder

     *          null.
     */
    public boolean[] getKeyUsage() {
  boolean[] res = null;
  byte[] ext_value;
  DERDecoder dec;
  ByteArrayInputStream bais;
  ASN1BitString bits;

  String ku_oid = "2.5.29.15";

  // get the extension "key usage"
  ext_value = getExtensionValue(ku_oid);

  // is it present?
  if (ext_value != null) {

      // read the extension value through a byte array input stream
      bais = new ByteArrayInputStream(ext_value);

      try {

    // build outer sequence
    bits = new ASN1BitString();

    dec = new DERDecoder(bais);

    /*
     * Replaced the construct dec.readX(X) by the correct use of
     * X.decode(dec). The latter takes into consideration any
     * special decoding steps (such as optimizations) done by the
View Full Code Here

Examples of codec.asn1.DERDecoder

     * @throws IOException DOCUMENT ME!
     */
    public void decode(byte[] encodedData) throws ASN1Exception, IOException
    {
        ByteArrayInputStream in;
        DERDecoder decoder;

        /* Initialize input stream containing the encoded data.
         */
        in     = new ByteArrayInputStream(encodedData);

        /* Initialize decoder instance with this input stream.
         */
        decoder = new DERDecoder(in);

        /* Decode the data in the input stream and stored it in the member
         * variables of this class that represent the components of the
         * corresponding ASN.1 type.
         */
        this.decode(decoder);

        /* Close the stream.
         */
        decoder.close();
    }
View Full Code Here

Examples of codec.asn1.DERDecoder

     * @throws IOException DOCUMENT ME!
     */
    public void decode(byte[] encodedData) throws ASN1Exception, IOException
    {
        ByteArrayInputStream in;
        DERDecoder decoder;

        in          = new ByteArrayInputStream(encodedData);
        decoder     = new DERDecoder(in);

        this.decode(decoder);
        decoder.close();
    }
View Full Code Here

Examples of codec.asn1.DERDecoder

     * Constructor on an input stream that delivers the DER-encoded certificate
     * revocation list.
     */
    public X509Crl(InputStream is) throws ASN1Exception, IOException {
  this();
  this.decode(new DERDecoder(is));
    }
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.