Examples of ASN1Type


Examples of codec.asn1.ASN1Type

  if (!(values_ instanceof ASN1SetOf)) {
      return;
  }
  ArrayList list;
  ASN1Type o;
  Iterator i;

  try {
      list = new ArrayList(values_.size());
View Full Code Here

Examples of codec.asn1.ASN1Type

     *
     * @return The raw key decoded according to DER.
     */
    public ASN1Type getDecodedRawKey() throws CorruptedCodeException {
  DERDecoder dec;
  ASN1Type raw;

  try {
      dec = new DERDecoder(new ByteArrayInputStream(encodedKey_
        .getByteArray()));

View Full Code Here

Examples of codec.asn1.ASN1Type

     *                The {@link Decoder Decoder} to use.
     */
    public void decode(Decoder decoder) throws ASN1Exception, IOException {
  super.decode(decoder);

  ASN1Type t;
  ASN1OpenType o;

  t = certValue_.getInnerType();
  if (t instanceof ASN1OpenType) {
      o = (ASN1OpenType) t;
View Full Code Here

Examples of codec.asn1.ASN1Type

     *                The {@link Decoder Decoder} to use.
     */
    public void decode(Decoder decoder) throws ASN1Exception, IOException {
  super.decode(decoder);

  ASN1Type t;
  ASN1OpenType o;

  t = bagValue_.getInnerType();
  if (t instanceof ASN1OpenType) {
      o = (ASN1OpenType) t;
View Full Code Here

Examples of codec.asn1.ASN1Type

     *                The {@link Decoder Decoder} to use.
     */
    public void decode(Decoder decoder) throws ASN1Exception, IOException {
  super.decode(decoder);

  ASN1Type t;
  ASN1OpenType o;

  t = crlValue_.getInnerType();
  if (t instanceof ASN1OpenType) {
      o = (ASN1OpenType) t;
View Full Code Here

Examples of codec.asn1.ASN1Type

     * 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();
View Full Code Here

Examples of codec.asn1.ASN1Type

    }

    public void decode(Decoder dec) throws ASN1Exception, IOException {
  super.decode(dec);

  ASN1Type inner = (ASN1Type) super.getValue();

  if (!(inner instanceof ASN1OctetString)) {
      throw new ASN1Exception("Inner value of wrong type: "
        + inner.getClass().getName());
  }
  keyIdentifier = (ASN1OctetString) inner;
    }
View Full Code Here

Examples of codec.asn1.ASN1Type

      seq.add(oid.clone());

      if (entry.isEncodedValue()) {
    ByteArrayInputStream in;
    BERDecoder dec;
    ASN1Type obj;
    byte[] buf;

    try {
        buf = entry.getEncodedValue();
        in = new ByteArrayInputStream(buf);
View Full Code Here

Examples of codec.asn1.ASN1Type

     */
    public List getAVAList() {
  ASN1ObjectIdentifier oid;
  ASN1Sequence ava;
  ArrayList list;
  ASN1Type obj;
  Iterator i;
  boolean sibling;
  ASN1Set rdn;
  String val;
  String key;
  AVA entry;
  int j;
  int n;

  list = new ArrayList(size());

  for (i = iterator(); i.hasNext();) {
      rdn = (ASN1Set) i.next();
      n = rdn.size();

      for (j = 0; j < n; j++) {
    /*
     * We have to mark siblings. An AVA has a sibling if it is not
     * the last AVA in the set.
     */
    sibling = (j < n - 1);

    /*
     * Convert key and value into strings. These values are then put
     * into an AVA instance.
     */
    ava = (ASN1Sequence) rdn.get(j);
    oid = (ASN1ObjectIdentifier) ava.get(0);
    obj = (ASN1Type) ava.get(1);
    key = (String) oid2a_.get(oid);

    if (key == null) {
        key = oid.toString();
    }
    if (obj instanceof ASN1String) {
        val = ((ASN1String) obj).getString();
        entry = new AVA(key, val, sibling);
    } else {
        /*
         * 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) {
View Full Code Here

Examples of codec.asn1.ASN1Type

     */
    public List getReverseAVAList() {
  ASN1ObjectIdentifier oid;
  ASN1Sequence ava;
  ArrayList list;
  ASN1Type obj;
  boolean sibling;
  ASN1Set rdn;
  String val;
  String key;
  AVA entry;
  int i;
  int j;
  int n;

  list = new ArrayList(size());

  for (i = size() - 1; i >= 0; i--) {
      rdn = (ASN1Set) get(i);
      n = rdn.size();

      for (j = 0; j < n; j++) {
    /*
     * We have to mark siblings. An AVA has a sibling if it is not
     * the last AVA in the set.
     */
    sibling = (j < n - 1);

    /*
     * Convert key and value into strings. These values are then put
     * into an AVA instance.
     */
    ava = (ASN1Sequence) rdn.get(j);
    oid = (ASN1ObjectIdentifier) ava.get(0);
    obj = (ASN1Type) ava.get(1);
    key = (String) oid2a_.get(oid);

    if (key == null) {
        key = oid.toString();
    }
    if (obj instanceof ASN1String) {
        val = ((ASN1String) obj).getString();
        entry = new AVA(key, val, sibling);
    } else {
        /*
         * 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) {
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.