Package codec.asn1

Examples of codec.asn1.ASN1Integer


  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()) {
        /*
         * Replaced long->string->int parsing with a simpler method
         * with the same type of loss of precision. --volker roth
         */
        res = pathLen.getBigInteger().intValue();
    }
      } catch (Exception e) {

    // EXCEPTION HANDLING!!!
    System.out.println("gbc Internal Error.Shouldnt happen");
View Full Code Here


  if (version < 2 && !extensionsTag_.isOptional()) {
      throw new IllegalArgumentException("can't set to " + version
        + ", extensions are present");
  }
  opt = (version == 0);
  tt = new ASN1TaggedType(0, new ASN1Integer(version), true, opt);

  set(0, tt);
    }
View Full Code Here

  // set payload
  cA = new ASN1Boolean(_cA);
  cA.setOptional(false); // I'm in doubt if that's neccessary

  if (_cA && _pathLenConstraints >= 0) {
      pathLenConstraints = new ASN1Integer(_pathLenConstraints);
      pathLenConstraints.setOptional(false); // mark that it's there
  } else {
      pathLenConstraints = new ASN1Integer(); // default set
      pathLenConstraints.setOptional(true); // but invisible
  }

  // now put things together
  basicConstraintsSyntax = new ASN1Sequence();
View Full Code Here

        super(2);

        /* Create ASN.1 objects with the parameters.
         */
        productName_        = new ASN1IA5String(productName);
        neededQuantity_     = new ASN1Integer(neededQuantity);

        /* Add the member variables to this class.
         */
        add(productName_);
        add(neededQuantity_);
View Full Code Here

        /* Initialize the member variables ready for decoding each component
         * of the SEQUENCE.
         */
        productName_        = new ASN1IA5String();
        neededQuantity_     = new ASN1Integer();

        /* Add the member variables to the class.
         */
        add(productName_);
        add(neededQuantity_);
View Full Code Here

     *
     * @param neededQuantity DOCUMENT ME!
     */
    public void setNeededQuantity(int neededQuantity)
    {
        neededQuantity_ = new ASN1Integer(neededQuantity);
        set(1, neededQuantity_);
    }
View Full Code Here

  super(4);

  ASN1Sequence seq;

  /* Global structure and Version */
  version_ = new ASN1Integer(0);
  add(version_);

  /* Issuer and serial number */
  issuer_ = new Name();
  serial_ = new ASN1Integer();

  seq = new ASN1Sequence(2);
  seq.add(issuer_);
  seq.add(serial_);
  add(seq);
View Full Code Here

  if (cert == null || bek == null) {
      throw new NullPointerException("cert or bulk encryption key");
  }
  /* Global structure and Version */
  version_ = new ASN1Integer(0);
  add(version_);

  /* Issuer and serial number */
  issuer_ = new Name(cert.getIssuerDN().getName(), -1);
  serial_ = new ASN1Integer(cert.getSerialNumber());

  seq = new ASN1Sequence(2);
  seq.add(issuer_);
  seq.add(serial_);
  add(seq);
View Full Code Here

  if (cert == null || bek == null) {
      throw new NullPointerException("cert or bulk encryption key");
  }
  /* Global structure and Version */
  version_ = new ASN1Integer(0);
  add(version_);

  /* Issuer and serial number */
  // der scep hack der funktioniert hat
  // issuer_ = new Name(cert.getIssuerDN().getName(),true);
  issuer_ = new Name(cert.getIssuerDN().getName(), encType);
  serial_ = new ASN1Integer(cert.getSerialNumber());

  seq = new ASN1Sequence(2);
  seq.add(issuer_);
  seq.add(serial_);
  add(seq);
View Full Code Here

    public X509Crl() {

  CertificateList = new ASN1Sequence(3);
  TBSCertList = new ASN1Sequence(7);

  version = new ASN1Integer(1);
  /**/// BUGFIX: optional feld must be false if respective parameter is
  // set
  /**/
  version.setOptional(false);
  /**/// version.setOptional(true);
View Full Code Here

TOP

Related Classes of codec.asn1.ASN1Integer

Copyright © 2018 www.massapicom. 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.