Package codec.asn1

Examples of codec.asn1.ASN1Sequence


     * Creates an instance ready for decoding.
     */
    public SignerInfo() {
  super(7);

  ASN1Sequence seq;

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

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

  seq = new ASN1Sequence(2);
  seq.add(issuer_);
  seq.add(serial_);

  add(seq);

  /* Digest Algorithm Identifier */
  dAlg_ = new AlgorithmIdentifier();
View Full Code Here


     *                registry shall be used.
     */
    public SignerInfo(OIDRegistry registry) {
  super(7);

  ASN1Sequence seq;

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

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

  seq = new ASN1Sequence(2);
  seq.add(issuer_);
  seq.add(serial_);

  add(seq);

  /* Digest Algorithm Identifier */
  dAlg_ = new AlgorithmIdentifier();
View Full Code Here

     */
    public SignerInfo(X509Certificate cert, String algorithm)
      throws BadNameException, NoSuchAlgorithmException {
  super(7);

  ASN1Sequence seq;
  String d;
  String c;

  /* Global structure and Version */
  version_ = new ASN1Integer(1);
  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);

  /*
   * We now initialize the algorithm identifiers. The style is according
View Full Code Here

    public SignerInfo(X509Certificate cert, String algorithm, int nameEncoding)
      throws BadNameException, NoSuchAlgorithmException {
  super(7);

  ASN1Sequence seq;
  String d;
  String c;

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

  /* Issuer and serial number */
  // System.out.println("Choosen Printable");
  issuer_ = new Name(cert.getIssuerDN().getName(), nameEncoding);
  serial_ = new ASN1Integer(cert.getSerialNumber());

  seq = new ASN1Sequence(2);
  seq.add(issuer_);
  seq.add(serial_);

  add(seq);

  /*
   * We now initialize the algorithm identifiers. The style is according
View Full Code Here

    public SignerInfo(X509Certificate cert, String algorithm,
      AlgorithmParameters params) throws BadNameException,
      NoSuchAlgorithmException, InvalidAlgorithmParameterException {
  super(7);

  ASN1Sequence seq;
  String s;

  /* Global structure and Version */
  version_ = new ASN1Integer(1);
  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);

  /*
   * We now initialize the algorithm identifiers. The style is PKCS#1
View Full Code Here

      AlgorithmParameters params, int nameEncoding)
      throws BadNameException, NoSuchAlgorithmException,
      InvalidAlgorithmParameterException {
  super(7);

  ASN1Sequence seq;
  String s;

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

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

  seq = new ASN1Sequence(2);
  seq.add(issuer_);
  seq.add(serial_);

  add(seq);

  /*
   * We now initialize the algorithm identifiers. The style is PKCS#1
View Full Code Here

  add(signature_);

  issuer_ = new codec.x501.Name();
  add(issuer_);

  ASN1Sequence validity = new ASN1Sequence();
  notBefore_ = new ASN1Choice();
  notBefore_.addType(new ASN1UTCTime());
  notBefore_.addType(new ASN1GeneralizedTime());
  validity.add(notBefore_);
  notAfter_ = new ASN1Choice();
  notAfter_.addType(new ASN1UTCTime());
  notAfter_.addType(new ASN1GeneralizedTime());
  validity.add(notAfter_);
  add(validity);

  subject_ = new codec.x501.Name();
  add(subject_);
View Full Code Here

    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()) {
        /*
         * Replaced long->string->int parsing with a simpler method
View Full Code Here

  otherNameID_ = new ASN1ObjectIdentifier();
  otherNameValue_ = new ASN1OpenType();

  otherNameValueTag_ = new ASN1TaggedType(0, otherNameValue_, true, false);

  otherNameSequence_ = new ASN1Sequence();
  otherNameSequence_.add(otherNameID_);
  otherNameSequence_.add(otherNameValueTag_);

  otherName_ = new ASN1TaggedType(TYPE_OTHER_NAME, otherNameSequence_,
    false, false);
View Full Code Here

      pathLenConstraints = new ASN1Integer(); // default set
      pathLenConstraints.setOptional(true); // but invisible
  }

  // now put things together
  basicConstraintsSyntax = new ASN1Sequence();
  if (_cA) {
      basicConstraintsSyntax.add(cA);
      basicConstraintsSyntax.add(pathLenConstraints);
  }
View Full Code Here

TOP

Related Classes of codec.asn1.ASN1Sequence

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.