Examples of DEREncoder


Examples of codec.asn1.DEREncoder

     */
    public byte[] getEncoded() throws java.security.cert.CRLException {
  ByteArrayOutputStream baos = new ByteArrayOutputStream();

  try {
      crlEntry_.encode(new DEREncoder(baos));
  } catch (Exception e) {
      throw new java.security.cert.CRLException(e.getMessage());
  }

  return baos.toByteArray();
View Full Code Here

Examples of codec.asn1.DEREncoder

      X509Extension theEx = (X509Extension) it.next();

      if (theEx.getOID().toString().equals(oid)) {
    try {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        theEx.encode(new DEREncoder(baos));
        res = baos.toByteArray();
    } catch (Exception ignore) {
    }
      }
  }
View Full Code Here

Examples of codec.asn1.DEREncoder

  byte[] res = null;

  ByteArrayOutputStream baos = new ByteArrayOutputStream();

  try {
      encode(new DEREncoder(baos));
      res = baos.toByteArray();
      baos.close();
      s.write(res);
  } catch (ASN1Exception e) {
      throw new RuntimeException(e.toString());
View Full Code Here

Examples of codec.asn1.DEREncoder

     *
     * @return a byte array containing the DER-encoding of this extension
     */
    public byte[] getEncoded() throws CertificateEncodingException {
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  DEREncoder enc = new DEREncoder(bos);

  try {
      this.encode(enc);
      bos.close();
  } catch (IOException e) {
View Full Code Here

Examples of codec.asn1.DEREncoder

      // res = extnValue.getByteArray();

      try {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DEREncoder enc = new DEREncoder(baos);
    extnValue.encode(enc);
    res = baos.toByteArray();
    baos.close();
      } catch (ASN1Exception asn1e) {
    throw new IllegalStateException(
View Full Code Here

Examples of codec.asn1.DEREncoder

     */
    public void setValue(ASN1Type nval) throws CertificateEncodingException {
  ByteArrayOutputStream baos = new ByteArrayOutputStream();

  try {
      nval.encode(new DEREncoder(baos));
      extnValue.setByteArray(baos.toByteArray());
  } catch (Exception e) {
      throw new CertificateEncodingException(e.getMessage());
  }
    }
View Full Code Here

Examples of codec.asn1.DEREncoder

     */
    public AlgorithmIdentifier(ASN1ObjectIdentifier oid, ASN1Type params)
      throws ASN1Exception {
  super(2);

  DEREncoder enc;
  ByteArrayOutputStream bos;

  if (oid == null)
      throw new NullPointerException("Need an OID!");

  algorithm_ = (ASN1ObjectIdentifier) oid.clone();

  try {
      if (params == null || (params instanceof ASN1Null))
    parameters_ = new ASN1Opaque(ASN1.TAG_NULL,
      ASN1.CLASS_UNIVERSAL, new byte[0]);
      else {
    bos = new ByteArrayOutputStream();
    enc = new DEREncoder(bos);
    params.encode(enc);

    parameters_ = new ASN1Opaque(bos.toByteArray());
    bos.close();
      }
View Full Code Here

Examples of codec.asn1.DEREncoder

         * OK, we have to encode the damn ASN.1 object. Outrageous
         * inefficient but hey, what choice do we have, if it is not
         * a string?
         */
        ByteArrayOutputStream out;
        DEREncoder enc;

        try {
      out = new ByteArrayOutputStream();
      enc = new DEREncoder(out);

      obj.encode(enc);

      entry = new AVA(key, out.toByteArray(), sibling);

      enc.close();
        } catch (Exception e) {
      throw new IllegalStateException("Cannot BER encode!");
        }
    }
    list.add(entry);
View Full Code Here

Examples of codec.asn1.DEREncoder

         * OK, we have to encode the damn ASN.1 object. Outrageous
         * inefficient but hey, what choice do we have, if it is not
         * a string?
         */
        ByteArrayOutputStream out;
        DEREncoder enc;

        try {
      out = new ByteArrayOutputStream();
      enc = new DEREncoder(out);

      obj.encode(enc);

      entry = new AVA(key, out.toByteArray(), sibling);

      enc.close();
        } catch (Exception e) {
      throw new IllegalStateException("Cannot BER encode!");
        }
    }
    list.add(entry);
View Full Code Here

Examples of codec.asn1.DEREncoder

  if (t instanceof Data) {
      update(((Data) t).getByteArray());
      return;
  }
  ByteArrayOutputStream bos;
  DEREncoder enc;

  /*
   * We know it must be EXPLICIT but hey...
   */
  tagging = t.isExplicit();
  bos = new ByteArrayOutputStream();
  enc = new DEREncoder(bos);

  if (this.strict)
      enc.setStrict(true);

  try {
      t.setExplicit(false);
      enc.writeType(t);

      update(bos.toByteArray());
  } catch (Exception e) {
      throw new SignatureException("Exception while re-encoding!");
  } finally {
      t.setExplicit(tagging);

      try {
    enc.close();
      } catch (Exception e) {
      }
  }
    }
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.