Examples of DEREncoder


Examples of codec.asn1.DEREncoder

     * @throws IOException DOCUMENT ME!
     */
    public byte[] getEncoded() throws ASN1Exception, IOException
    {
        ByteArrayOutputStream out;
        DEREncoder encoder;
        byte[] encodedAsn1Object;

        out         = new ByteArrayOutputStream();
        encoder     = new DEREncoder(out);

        this.encode(encoder);
        encodedAsn1Object = out.toByteArray();
        encoder.close();

        return encodedAsn1Object;
    }
View Full Code Here

Examples of codec.asn1.DEREncoder

     * @throws IOException DOCUMENT ME!
     */
    public byte[] getEncoded() throws ASN1Exception, IOException
    {
        ByteArrayOutputStream out;
        DEREncoder encoder;
        byte[] encodedAsn1Object;

        out         = new ByteArrayOutputStream();
        encoder     = new DEREncoder(out);

        this.encode(encoder);
        encodedAsn1Object = out.toByteArray();
        encoder.close();

        return encodedAsn1Object;
    }
View Full Code Here

Examples of codec.asn1.DEREncoder

     * @throws IOException DOCUMENT ME!
     */
    public byte[] getEncoded() throws ASN1Exception, IOException
    {
        ByteArrayOutputStream out;
        DEREncoder encoder;
        byte[] encodedAsn1Object;

        out         = new ByteArrayOutputStream();
        encoder     = new DEREncoder(out);

        this.encode(encoder);
        encodedAsn1Object = out.toByteArray();
        encoder.close();

        return encodedAsn1Object;
    }
View Full Code Here

Examples of codec.asn1.DEREncoder

     * @throws IOException DOCUMENT ME!
     */
    public byte[] getEncoded() throws ASN1Exception, IOException
    {
        ByteArrayOutputStream out;
        DEREncoder encoder;
        byte[] encodedAsn1Object;

        out         = new ByteArrayOutputStream();
        encoder     = new DEREncoder(out);

        this.encode(encoder);
        encodedAsn1Object = out.toByteArray();
        encoder.close();

        return encodedAsn1Object;
    }
View Full Code Here

Examples of codec.asn1.DEREncoder

  if (sig == null)
      throw new NullPointerException("Sig is null!");

  if (auth_.size() > 0) {
      ByteArrayOutputStream bos;
      DEREncoder enc;

      try {
    bos = new ByteArrayOutputStream();
    enc = new DEREncoder(bos);
    if (this.strict)
        enc.setStrict(true);

    /*
     * Because the authenticated attributes are tagged IMPLICIT in
     * version 1.5 we have to set tagging to EXPLICIT during
     * encoding. Otherwise the identifier and length octets would be
     * missing in the encoding.
     */
    auth_.setExplicit(true);
    auth_.encode(enc);

    sig.update(bos.toByteArray());

    enc.close();
      } catch (ASN1Exception e) {
    throw new InconsistentStateException(e);
      } catch (IOException e) {
    throw new InconsistentStateException(e);
      } finally {
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();
  } catch (IOException e) {
      System.out.println("internal error:");
      e.printStackTrace();
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) {
    /* Ignore */
      }
  }
    }
View Full Code Here

Examples of codec.asn1.DEREncoder

     * @throws IOException DOCUMENT ME!
     */
    public byte[] getEncoded() throws ASN1Exception, IOException
    {
        ByteArrayOutputStream out;
        DEREncoder encoder;
        byte[] encodedAsn1Object;

        /* Initialize an output stream to which the encoded data will be
         * written.
         */
        out     = new ByteArrayOutputStream();

        /* Initialize encoder instance with this output stream.
         */
        encoder = new DEREncoder(out);

        /* Encoder reads the data stored in the member variables of this class
         * and encodes it writing the output to the output stream.
         */
        this.encode(encoder);

        /* Store the data in the output stream in a byte array. This array will
         * be returned by this method.
         */
        encodedAsn1Object = out.toByteArray();

        /* Close the stream.
         */
        encoder.close();

        /* Return the encoded data.
         */
        return encodedAsn1Object;
    }
View Full Code Here

Examples of codec.asn1.DEREncoder

     * @throws IOException DOCUMENT ME!
     */
    public byte[] getEncoded() throws ASN1Exception, IOException
    {
        ByteArrayOutputStream out;
        DEREncoder encoder;
        byte[] encodedAsn1Object;

        out         = new ByteArrayOutputStream();
        encoder     = new DEREncoder(out);

        this.encode(encoder);
        encodedAsn1Object = out.toByteArray();
        encoder.close();

        return encodedAsn1Object;
    }
View Full Code Here

Examples of codec.asn1.DEREncoder

    public byte[] getEncoded() throws java.security.cert.CRLException {

  java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();

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

  return baos.toByteArray();
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.