internal static void SetSignatureParameters(
     ISigner			signature,
     Asn1Encodable	parameters)
 {
     if (parameters != null && !derNull.Equals(parameters))
     {
         // TODO Put back in
     //				AlgorithmParameters sigParams = AlgorithmParameters.GetInstance(signature.getAlgorithm());
     //
     //				try
     //				{
     //					sigParams.Init(parameters.ToAsn1Object().GetDerEncoded());
     //				}
     //				catch (IOException e)
     //				{
     //					throw new SignatureException("IOException decoding parameters: " + e.Message);
     //				}
     //
     //				if (signature.getAlgorithm().EndsWith("MGF1"))
     //				{
     //					try
     //					{
     //						signature.setParameter(sigParams.getParameterSpec(PSSParameterSpec.class));
     //					}
     //					catch (GeneralSecurityException e)
     //					{
     //						throw new SignatureException("Exception extracting parameters: " + e.Message);
     //					}
     //				}
     }
 }
		/**
		 * add a given extension field for the standard extensions tag (tag 3)
		 * @throws IOException
		 */
		public void AddExtension(
			string			oid,
			bool			critical,
			Asn1Encodable	value)
		{
			this.AddExtension(oid, critical, value.GetEncoded());
		}
		public OtherRecipientInfo(
            DerObjectIdentifier	oriType,
            Asn1Encodable		oriValue)
        {
            this.oriType = oriType;
            this.oriValue = oriValue;
        }
		public OtherKeyAttribute(
            DerObjectIdentifier	keyAttrId,
            Asn1Encodable		keyAttr)
        {
            this.keyAttrId = keyAttrId;
            this.keyAttr = keyAttr;
        }
Example #5
0
		public ContentInfo(
			DerObjectIdentifier	contentType,
			Asn1Encodable		content)
		{
			this.contentType = contentType;
			this.content = content;
		}
Example #6
0
		public CertStatus(
            int				tagNo,
            Asn1Encodable	value)
        {
            this.tagNo = tagNo;
            this.value = value;
        }
		/**
		 * @param explicitly true if an explicitly tagged object.
		 * @param tagNo the tag number for this object.
		 * @param obj the tagged object.
		 */
		public BerTaggedObject(
			bool			explicitly,
			int				tagNo,
			Asn1Encodable	obj)
			: base(explicitly, tagNo, obj)
		{
		}
Example #8
0
 public QCStatement(
     DerObjectIdentifier qcStatementId,
     Asn1Encodable       qcStatementInfo)
 {
     this.qcStatementId = qcStatementId;
     this.qcStatementInfo = qcStatementInfo;
 }
Example #9
0
		public ResponderID(
            X509Name id)
        {
			if (id == null)
				throw new ArgumentNullException("id");

			this.id = id;
        }
		/**
         * @param tagNo the tag number for this object.
         * @param obj the tagged object.
         */
        protected Asn1TaggedObject(
            int             tagNo,
            Asn1Encodable   obj)
        {
            this.explicitly = true;
            this.tagNo = tagNo;
            this.obj = obj;
        }
Example #11
0
		public ResponderID(
            Asn1OctetString id)
        {
			if (id == null)
				throw new ArgumentNullException("id");

			this.id = id;
        }
		public Iso4217CurrencyCode(
            string alphabetic)
        {
            if (alphabetic.Length > AlphabeticMaxSize)
            {
                throw new ArgumentException("wrong size in alphabetic code : max size is " + AlphabeticMaxSize);
            }

			obj = new DerPrintableString(alphabetic);
        }
Example #13
0
		private ContentInfo(
            Asn1Sequence seq)
        {
			contentType = (DerObjectIdentifier) seq[0];

			if (seq.Count > 1)
			{
				content = ((Asn1TaggedObject) seq[1]).GetObject();
			}
        }
		/**
         * @param explicitly true if the object is explicitly tagged.
         * @param tagNo the tag number for this object.
         * @param obj the tagged object.
         */
        protected Asn1TaggedObject(
            bool            explicitly,
            int             tagNo,
            Asn1Encodable   obj)
        {
			// IAsn1Choice marker interface 'insists' on explicit tagging
            this.explicitly = explicitly || (obj is IAsn1Choice);
            this.tagNo = tagNo;
            this.obj = obj;
        }
		public Iso4217CurrencyCode(
            int numeric)
        {
            if (numeric > NumericMaxSize || numeric < NumericMinSize)
            {
                throw new ArgumentException("wrong size in numeric code : not in (" +NumericMinSize +".."+ NumericMaxSize +")");
            }

			obj = new DerInteger(numeric);
        }
Example #16
0
		private QCStatement(
            Asn1Sequence seq)
        {
			qcStatementId = DerObjectIdentifier.GetInstance(seq[0]);

			if (seq.Count > 1)
			{
				qcStatementInfo = seq[1];
			}
        }
Example #17
0
		public Asn1Encodable[] GetValues()
		{
			Asn1Set s = attr.AttrValues;
			Asn1Encodable[] values = new Asn1Encodable[s.Count];

			for (int i = 0; i != s.Count; i++)
			{
				values[i] = (Asn1Encodable)s[i];
			}

			return values;
		}
        internal Asn1OctetString(
            Asn1Encodable obj)
        {
            try
            {
				this.str = obj.GetEncoded(Asn1Encodable.Der);
            }
            catch (IOException e)
            {
                throw new ArgumentException("Error processing object : " + e.ToString());
            }
        }
		public TypeOfBiometricData(
			int predefinedBiometricType)
        {
            if (predefinedBiometricType == Picture || predefinedBiometricType == HandwrittenSignature)
            {
                obj = new DerInteger(predefinedBiometricType);
            }
            else
            {
                throw new ArgumentException("unknow PredefinedBiometricType : " + predefinedBiometricType);
            }
        }
    /**
        * Creates a new <code>CommitmentTypeQualifier</code> instance.
        *
        * @param commitmentTypeIdentifier a <code>CommitmentTypeIdentifier</code> value
        * @param qualifier the qualifier, defined by the above field.
        */
        public CommitmentTypeQualifier(
            DerObjectIdentifier	commitmentTypeIdentifier,
            Asn1Encodable		qualifier)
        {
			if (commitmentTypeIdentifier == null)
				throw new ArgumentNullException("commitmentTypeIdentifier");

			this.commitmentTypeIdentifier = commitmentTypeIdentifier;

			if (qualifier != null)
			{
				this.qualifier = qualifier.ToAsn1Object();
			}
        }
		public SmimeCapability(
            DerObjectIdentifier	capabilityID,
            Asn1Encodable		parameters)
        {
			if (capabilityID == null)
				throw new ArgumentNullException("capabilityID");

			this.capabilityID = capabilityID;

			if (parameters != null)
			{
				this.parameters = parameters.ToAsn1Object();
			}
        }
Example #22
0
		public CertStatus(
            Asn1TaggedObject choice)
        {
            this.tagNo = choice.TagNo;

			switch (choice.TagNo)
            {
				case 1:
					value = RevokedInfo.GetInstance(choice, false);
					break;
				case 0:
				case 2:
					value = DerNull.Instance;
					break;
            }
        }
Example #23
0
		private ContentInfo(
			Asn1Sequence seq)
		{
			if (seq.Count < 1 || seq.Count > 2)
				throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");

			contentType = (DerObjectIdentifier) seq[0];

			if (seq.Count > 1)
			{
				Asn1TaggedObject tagged = (Asn1TaggedObject) seq[1];
				if (!tagged.IsExplicit() || tagged.TagNo != 0)
					throw new ArgumentException("Bad tag for 'content'", "seq");

				content = tagged.GetObject();
			}
		}
		public DerApplicationSpecific(
			bool			isExplicit,
			int				tag,
			Asn1Encodable	obj)
		{
			byte[] data = obj.GetDerEncoded();

			this.isConstructed = isExplicit;
			this.tag = tag;

			if (isExplicit)
			{
				this.octets = data;
			}
			else
			{
				int lenBytes = GetLengthOfLength(data);
				byte[] tmp = new byte[data.Length - lenBytes];
				Array.Copy(data, lenBytes, tmp, 0, tmp.Length);
				this.octets = tmp;
			}
		}
		public ECPrivateKeyStructure(
			BigInteger		key,
			DerBitString	publicKey,
			Asn1Encodable	parameters)
		{
			if (key == null)
				throw new ArgumentNullException("key");

			Asn1EncodableVector v = new Asn1EncodableVector(
				new DerInteger(1),
				new DerOctetString(key.ToByteArrayUnsigned()));

			if (parameters != null)
			{
				v.Add(new DerTaggedObject(true, 0, parameters));
			}

			if (publicKey != null)
			{
				v.Add(new DerTaggedObject(true, 1, publicKey));
			}

			this.seq = new DerSequence(v);
		}
Example #26
0
 /**
  * @param tagNo the tag number for this object.
  * @param obj the tagged object.
  */
 public BerTaggedObject(
     int tagNo,
     Asn1Encodable obj)
     : base(tagNo, obj)
 {
 }
Example #27
0
 public override void AddObject(
     Asn1Encodable obj)
 {
     new BerOutputStream(Out).WriteObject(obj);
 }
Example #28
0
		public virtual Asn1Encodable[] ToArray()
		{
			Asn1Encodable[] values = new Asn1Encodable[this.Count];
			for (int i = 0; i < this.Count; ++i)
			{
				values[i] = this[i];
			}
			return values;
		}
Example #29
0
		protected internal void AddObject(
			Asn1Encodable obj)
        {
            _set.Add(obj);
        }
Example #30
0
 protected internal void AddObject(
     Asn1Encodable obj)
 {
     _set.Add(obj);
 }
Example #31
0
        /**
         * @param obj - a single object that makes up the set.
         */

        public DerSet(Asn1Encodable obj) : base(1)
        {
            AddObject(obj);
        }
Example #32
0
		public CertStatus(
            RevokedInfo info)
        {
            tagNo = 1;
            value = info;
        }
Example #33
0
		/**
         * create a CertStatus object with a tag of zero.
         */
        public CertStatus()
        {
            tagNo = 0;
            value = DerNull.Instance;
        }
		public SignerIdentifier(
            Asn1Object id)
        {
            this.id = id;
        }