Package codec.asn1

Examples of codec.asn1.ASN1ObjectIdentifier


     *
     * @throws Exception
     */
    public CertificateIssuerExtension(GeneralName generalName) throws Exception {
  super();
  setOID(new ASN1ObjectIdentifier(ID_CE_CERTIFICATE_ISSUER));
  setCritical(true);
  certIssuer = new ASN1SequenceOf(GeneralName.class);
  certIssuer.add(generalName);
  setValue(certIssuer);
    }
View Full Code Here


     * Constructor for SubjectKeyIdentifierExtension.
     *
     * @throws Exception
     */
    public SubjectKeyIdentifierExtension() throws Exception {
  setOID(new ASN1ObjectIdentifier(ID_CE_SUBJECT_KEY_IDENTIFIER_));
    }
View Full Code Here

    /**
     * sets the NamingAuthorityID
     */
    public void setNamingId(String oid) {
  this.namingID = new ASN1ObjectIdentifier(oid);
  this.add(namingID);
    }
View Full Code Here

    /**
     * Constructor
     */
    public ValidityModelExtension() throws Exception {
  // set parameters
  setOID(new ASN1ObjectIdentifier(EXTENSION_OID));
  setCritical(false);
  oid_ = new ASN1ObjectIdentifier("1.3.6.1.4.1.8301.3.5.1");

  // info_ = new ASN1OpenType();
  info_ = new codec.asn1.ASN1Null();
  info_.setOptional(true);

View Full Code Here

   * parameters. In principle, the would have to be some registry which
   * resolves the ANY DEFINED BY type. If the statement info is never
   * actually required then an ASN1Opaque may be used to save the overhead
   * of actually decoding the info. --volker roth
   */
  oid_ = new ASN1ObjectIdentifier();
  info_ = new ASN1Null();
  info_.setOptional(true);
  add(oid_);
  add(info_);
    }
View Full Code Here

     * before encryption or decryption operation can commence.
     */
    public EncryptedContentInfo() {
  super(3);

  contentType_ = new ASN1ObjectIdentifier();
  cAlg_ = new AlgorithmIdentifier();
  econtent_ = new ASN1TaggedType(0, new ASN1OctetString(), false, true);

  add(contentType_);
  add(cAlg_);
View Full Code Here

      AlgorithmParameters params)
      throws InvalidAlgorithmParameterException {
  if (bea == null || bek == null) {
      throw new NullPointerException("BEK or BEA is null!");
  }
  contentType_ = new ASN1ObjectIdentifier(DATA_OID);
  cAlg_ = new AlgorithmIdentifier(bea, params);
  econtent_ = new ASN1TaggedType(0, new ASN1OctetString(), false, true);

  add(contentType_);
  add(cAlg_);
View Full Code Here

  crypt(in, out, Cipher.ENCRYPT_MODE);

  b = out.toByteArray();
  out.close();

  contentType_ = new ASN1ObjectIdentifier(DATA_OID);
  econtent_ = new ASN1TaggedType(0, new ASN1OctetString(b), false, false);

  clear();
  add(contentType_);
  add(cAlg_);
View Full Code Here

     *                 of the corresponding <code>SignedData</code>.
     */
    public Verifier(Signable sigdat, SignerInfo info, X509Certificate cert)
      throws GeneralSecurityException {
  AlgorithmParameterSpec spec;
  ASN1ObjectIdentifier oid;
  ASN1OctetString octets;
  Attributes attributes;
  Attribute attribute;
  String sigalg;
  String mdalg;

  /*
   * Either a certificate or a SignerInfo is needed. We might do without
   * one of'em but not without both. The SignedData is need in every case.
   */
  if (info == null && cert == null) {
      throw new IllegalArgumentException(
        "Need either a SignerInfo or a certificate!");
  }
  if (sigdat == null) {
      throw new NullPointerException("Need a SignedData!");
  }
  target_ = sigdat;

  /*
   * If the SignerInfo is null then we try to get it from the SignedData.
   */
  if (info == null) {
      info = target_.getSignerInfo(cert);

      if (info == null) {
    throw new NoSuchSignerException("No signer info found for: "
      + cert.getIssuerDN().getName() + ", "
      + cert.getSerialNumber());
      }
  }
  /*
   * If we have a SignerInfo but no certificate the we try and see if we
   * can get it from the SignedData.
   */
  else if (cert == null) {
      cert = target_.getCertificate(info.getIssuerDN(), info
        .getSerialNumber());

      if (cert == null) {
    throw new CertificateException("No certificate available for: "
      + info.getIssuerDN().getName() + ", "
      + info.getSerialNumber());
      }
  }
  /*
   * We have both a SignerInfo and a certificate, now let's see if they
   * have matching issuer and serial number.
   */
  else {
      if (!info.equivIssuerAndSerialNumber(cert)) {
    throw new IllegalArgumentException(
      "SignerInfo and certificate don't match!");
      }
  }
  /*
   * At this point we should have both a SignerInfo and a matching
   * certificate.
   */
  info_ = info;
  cert_ = cert;
  sigalg = info_.getAlgorithm();

  /*
   * We now check for a simple one-step verification or a two-step
   * verification. One-step occurs only in the degenerate case that the
   * content type of the SignedData instance is DATA and there are no
   * authenticated attributes in it.
   *
   * Otherwise we have to check painfully for the various details on
   * required attributes.
   */
  attributes = info_.authenticatedAttributes();
  oid = target_.getContentType();

  if (attributes.size() > 0 || !oid.equals(DATA)) {
      twostep_ = true;

      attribute = info_.authenticatedAttributes().getAttribute(
        CONTENT_TYPE);

      if (attribute == null) {
    throw new NoSuchAttributeException(
      "ContentType attribute missing!");
      }
      if (attribute.valueCount() == 0) {
    throw new InvalidAttributeException(
      "ContentType attribute has no OID!");
      }
      if (!oid.equals(attribute.valueAt(0))) {
    throw new InvalidAttributeException(
      "ContentType attribute mismatch!");
      }
      attribute = info_.authenticatedAttributes().getAttribute(
        MESSAGE_DIGEST);
View Full Code Here

        {
            if (map_.size() == 0)
            {
                for (int i = 0; i < TYPES_.length; i++)
                {
                    map_.put(new ASN1ObjectIdentifier(OIDS_[i]), TYPES_[i]);
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of codec.asn1.ASN1ObjectIdentifier

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.