Examples of ASN1TaggedType


Examples of codec.asn1.ASN1TaggedType

    /**
     * adds the NamingAuthorities name
     */
    public void addNamingAuth(NamingAuthority na) {
  namingAuth = na;
  namingAuthTag = new ASN1TaggedType(TAG_NAMING_AUTH_, namingAuth, true,
    false);
  add(namingAuthTag);
    }
View Full Code Here

Examples of codec.asn1.ASN1TaggedType

  /*
   * Consequently, we must set the version to NOT OPTIONAL. So, the last
   * boolean must be false. --volker roth
   */
  versionTag_ = new ASN1TaggedType(0, version_, true, false);
  add(versionTag_);

  serialNumber_ = new ASN1Integer();
  add(serialNumber_);

  signature_ = new codec.x509.AlgorithmIdentifier();
  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_);

  subjectPublicKeyInfo_ = new SubjectPublicKeyInfo();
  add(subjectPublicKeyInfo_);

  issuerUniqueID_ = new ASN1BitString();
  issuerUniqueIDTag_ = new ASN1TaggedType(1, issuerUniqueID_, false, true);
  add(issuerUniqueIDTag_);

  subjectUniqueID_ = new ASN1BitString();
  subjectUniqueIDTag_ = new ASN1TaggedType(2, subjectUniqueID_, false,
    true);
  add(subjectUniqueIDTag_);

  extensions_ = new ASN1SequenceOf(X509Extension.class);
  extensionsTag_ = new ASN1TaggedType(3, extensions_, true, true);
  add(extensionsTag_);
    }
View Full Code Here

Examples of codec.asn1.ASN1TaggedType

    public void setVersion(int version) {
  /*
   * Added this method to set the version number explicitly. -- volker
   * roth
   */
  ASN1TaggedType tt;
  boolean opt;

  if (version < 0 || version > 2) {
      throw new IllegalArgumentException("illegal version number: "
        + version);
  }
  /*
   * This if statement is for safety reasons. If it causes trouble, and
   * you are willing to accept certificates with bad version numbers then
   * feel free to remove it. --volker roth
   */
  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

Examples of codec.asn1.ASN1TaggedType

  super();

  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);
  addType(otherName_);

  rfc822N_ = new ASN1IA5String();
  rfc822Name_ = new ASN1TaggedType(TYPE_RFC822_NAME, rfc822N_, false,
    false);
  addType(rfc822Name_);

  dNSN_ = new ASN1IA5String();
  dNSName_ = new ASN1TaggedType(TYPE_DNS_NAME, dNSN_, false, false);
  addType(dNSName_);

  // x400Address is not supported yet...

  dirN_ = new Name();
  // directoryName *MUST* be marked explicit here for the decoding
  // operation
  // to succeed. see also the setDirectoryName() method for more
  // information
  // --volker roth & ralf weinmann
  directoryName_ = new ASN1TaggedType(TYPE_DIRECTORY_NAME, dirN_, true,
    false);
  addType(directoryName_);

  // ediPartyName is not supported yet...

  uniformResourceId_ = new ASN1IA5String();
  uniformResourceIdentifier_ = new ASN1TaggedType(
    TYPE_UNIFORM_RESOURCE_IDENTIFIER, uniformResourceId_, false,
    false);
  addType(uniformResourceIdentifier_);

  iPAdr_ = new ASN1OctetString();

  iPAddress_ = new ASN1TaggedType(TYPE_IP_ADDRESS, iPAdr_, false, false);
  addType(iPAddress_);

  regID_ = new ASN1ObjectIdentifier();

  registeredID_ = new ASN1TaggedType(TYPE_REGISTERED_ID, regID_, false,
    false);
  addType(registeredID_);
    }
View Full Code Here

Examples of codec.asn1.ASN1TaggedType

    public ASN1Type getGeneralName() throws X509Exception {
  int tag = getTag();

  // extract the TaggedType first, then the "real" inner
  // value
  ASN1TaggedType inner = (ASN1TaggedType) getInnerType();

  switch (tag) {
  case TYPE_OTHER_NAME:
      return inner.getInnerType();
  case TYPE_RFC822_NAME:
      return inner.getInnerType();
  case TYPE_DNS_NAME:
      return inner.getInnerType();
  case TYPE_X400_ADDRESS:
      throw new X509Exception("x400Address not yet supported!");
  case TYPE_DIRECTORY_NAME:
      return inner.getInnerType();
  case TYPE_EDI_PARTY_NAME:
      throw new X509Exception("ediPartyName not yet supported!");
  case TYPE_UNIFORM_RESOURCE_IDENTIFIER:
      return inner.getInnerType();
  case TYPE_IP_ADDRESS:
      return inner.getInnerType();
  case TYPE_REGISTERED_ID:
      return inner.getInnerType();
  default:
      throw new X509Exception("Tag not supported for GeneralName: " + tag);
  }
    }
View Full Code Here

Examples of codec.asn1.ASN1TaggedType

  if (registry == null) {
      registry = PKCSRegistry.getDefaultRegistry();
  }
  contentType_ = new ASN1ObjectIdentifier();
  ot = new ASN1OpenType(registry, contentType_);
  content_ = new ASN1TaggedType(0, ot, true, true);

  add(contentType_);
  add(content_);
    }
View Full Code Here

Examples of codec.asn1.ASN1TaggedType

     */
    public void setContent(ASN1ObjectIdentifier oid, ASN1Type type) {
  clear();

  contentType_ = (ASN1ObjectIdentifier) oid.clone();
  content_ = new ASN1TaggedType(0, type, true);

  add(contentType_);
  add(content_);
    }
View Full Code Here

Examples of codec.asn1.ASN1TaggedType

  fullName_ = new ASN1SequenceOf(GeneralName.class);

  /*
   * We wrap the only CHOICE we support into the appropriate tagged type.
   */
  distributionPoint_ = new ASN1TaggedType(TAG_FULL_NAME, fullName_,
    false, false);
  /*
   * We wrap again. Flags are EXPLICIT and OPTIONAL.
   */
  distributionPointTag_ = new ASN1TaggedType(TAG_DISTRIBUTION_POINT,
    distributionPoint_, true, true);
  /*
   * Finally, we add the tagged type.
   */
  add(distributionPointTag_);

  /*
   * Next element with tag [1].
   */
  reasons_ = new ASN1BitString();
  reasonsTag_ = new ASN1TaggedType(TAG_REASONS, reasons_, false, true);
  add(reasonsTag_);

  /*
   * Final element with tag [2].
   */
  cRLIssuer_ = new ASN1SequenceOf(GeneralName.class);
  cRLIssuerTag_ = new ASN1TaggedType(TAG_CRL_ISSUER, cRLIssuer_, false,
    true);
  add(cRLIssuerTag_);
    }
View Full Code Here

Examples of codec.asn1.ASN1TaggedType

  crlExtensions = new ASN1SequenceOf(X509Extension.class);
  // ASN1TaggedType crl_ext = new ASN1TaggedType(0, crlExtensions, true,
  // true);
  // TBSCertList.add(crl_ext);
  crlExtensionsTag = new ASN1TaggedType(0, crlExtensions, true, true);
  TBSCertList.add(crlExtensionsTag);

  CertificateList.add(TBSCertList);

  signatureAlgorithm2 = new AlgorithmIdentifier();
View Full Code Here

Examples of codec.asn1.ASN1TaggedType

  crlExtensions = new ASN1SequenceOf(X509Extension.class);
  // ASN1TaggedType crl_ext = new ASN1TaggedType(0, crlExtensions, true,
  // true);
  // TBSCertList.add(crl_ext);
  crlExtensionsTag = new ASN1TaggedType(0, crlExtensions, true, true);
  TBSCertList.add(crlExtensionsTag);

  CertificateList.add(TBSCertList);

  signatureAlgorithm2 = new AlgorithmIdentifier();
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.