Package codec.asn1

Examples of codec.asn1.ASN1ObjectIdentifier


     * effects are caused by modifying it.
     *
     * @return The OID.
     */
    public ASN1ObjectIdentifier getOID() {
  return new ASN1ObjectIdentifier(THIS_OID);
    }
View Full Code Here


  if (d == null || c == null) {
      throw new NoSuchAlgorithmException(
        "Cannot resolve signature algorithm!");
  }
  try {
      dAlg_ = new AlgorithmIdentifier(new ASN1ObjectIdentifier(d),
        new ASN1Null());
      cAlg_ = new AlgorithmIdentifier(new ASN1ObjectIdentifier(c),
        new ASN1Null());
  } catch (ASN1Exception e) {
      throw new InconsistentStateException(e);
  }
  /* Digest Algorithm Identifier */
 
View Full Code Here

  if (d == null || c == null) {
      throw new NoSuchAlgorithmException(
        "Cannot resolve signature algorithm!");
  }
  try {
      dAlg_ = new AlgorithmIdentifier(new ASN1ObjectIdentifier(d),
        new ASN1Null());
      cAlg_ = new AlgorithmIdentifier(new ASN1ObjectIdentifier(c),
        new ASN1Null());
  } catch (ASN1Exception e) {
      throw new InconsistentStateException(e);
  }
  /* Digest Algorithm Identifier */
 
View Full Code Here

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

  /*
   * We can't do without both a SignerInfo and a private key.
   */
  if (sigdat == null || info == null || key == null) {
      throw new NullPointerException(
        "Need a Signable, SignerInfo and PrivateKey!");
  }
  info_ = info;
  target_ = sigdat;
  sigalg = info_.getAlgorithm();

  /*
   * Here comes the tough part. We have to check the authenticated
   * attributes. In the degenerated case of no authenticated attributes
   * and a content type of Data in the SignedData we do one-step signing.
   * In all other cases we have to use two steps and we have to add and/or
   * check attributes.
   */
  attributes = info_.authenticatedAttributes();
  oid = target_.getContentType();

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

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

      /*
       * If there is no content type attribute then we have to add one. If
       * there is one then we have to make sure that there is no mismatch.
       *
       * The code could correct and replace attributes with a wrong type,
       * but I guess it's better to throw an exception because something
       * with the application's code is probably wrong.
       */
      if (attribute == null) {
    attribute = new Attribute((ASN1ObjectIdentifier) CONTENT_TYPE
      .clone(), (ASN1ObjectIdentifier) oid.clone());

    attributes.add(attribute);
      } else if (attribute.valueCount() < 1) {
    throw new InvalidAttributeException(
      "Content type attribute has no value!");
View Full Code Here

  /*
   * Big question: is this extension critical or not? ISIS-MTT given the
   * code '--' in the table. This *probably* means not critical...
   */
  setCritical(false);
  setOID(new ASN1ObjectIdentifier(EXTENSION_OID));
  setValue(time_);
    }
View Full Code Here

  /*
   * Big question: is this extension critical or not? ISIS-MTT given the
   * code '--' in the table. This *probably* means not critical...
   */
  setCritical(false);
  setOID(new ASN1ObjectIdentifier(EXTENSION_OID));
  setValue(time_);
    }
View Full Code Here

    public ReasonCodeExtension() throws Exception {
  this(REASON_UNSPECIFIED);
    }

    public ReasonCodeExtension(int aReason) throws Exception {
  super.setOID(new ASN1ObjectIdentifier(ID_CE_CRL_REASON));
  setReasonCode(aReason);
    }
View Full Code Here

     * Text of the Restriction
     */
    private ASN1String restrictionText;

    public RestrictionExtension(ASN1String _text) throws Exception {
  setOID(new ASN1ObjectIdentifier(EXTENSION_OID));
  setValue(_text);
    }
View Full Code Here

     * Builds the structure of the class ready for decoding
     */
    public GeneralName() {
  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

     *
     * @param oid
     *                the name to be set
     */
    public void setRegisteredID(ASN1ObjectIdentifier oid) {
  regID_ = new ASN1ObjectIdentifier(oid.getOID());
  regID_.setExplicit(false);
  registeredID_.setInnerType(regID_);
  setInnerType(registeredID_);
    }
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.