コード例 #1
0
 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);
     //					}
     //				}
     }
 }
コード例 #2
0
		/**
		 * 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());
		}
コード例 #3
0
		public OtherRecipientInfo(
            DerObjectIdentifier	oriType,
            Asn1Encodable		oriValue)
        {
            this.oriType = oriType;
            this.oriValue = oriValue;
        }
コード例 #4
0
		public OtherKeyAttribute(
            DerObjectIdentifier	keyAttrId,
            Asn1Encodable		keyAttr)
        {
            this.keyAttrId = keyAttrId;
            this.keyAttr = keyAttr;
        }
コード例 #5
0
		public ContentInfo(
			DerObjectIdentifier	contentType,
			Asn1Encodable		content)
		{
			this.contentType = contentType;
			this.content = content;
		}
コード例 #6
0
		public CertStatus(
            int				tagNo,
            Asn1Encodable	value)
        {
            this.tagNo = tagNo;
            this.value = value;
        }
コード例 #7
0
		/**
		 * @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)
		{
		}
コード例 #8
0
 public QCStatement(
     DerObjectIdentifier qcStatementId,
     Asn1Encodable       qcStatementInfo)
 {
     this.qcStatementId = qcStatementId;
     this.qcStatementInfo = qcStatementInfo;
 }
コード例 #9
0
		public ResponderID(
            X509Name id)
        {
			if (id == null)
				throw new ArgumentNullException("id");

			this.id = id;
        }
コード例 #10
0
		/**
         * @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;
        }
コード例 #11
0
		public ResponderID(
            Asn1OctetString id)
        {
			if (id == null)
				throw new ArgumentNullException("id");

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

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

			if (seq.Count > 1)
			{
				content = ((Asn1TaggedObject) seq[1]).GetObject();
			}
        }
コード例 #14
0
		/**
         * @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;
        }
コード例 #15
0
		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);
        }
コード例 #16
0
		private QCStatement(
            Asn1Sequence seq)
        {
			qcStatementId = DerObjectIdentifier.GetInstance(seq[0]);

			if (seq.Count > 1)
			{
				qcStatementInfo = seq[1];
			}
        }
コード例 #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;
		}
コード例 #18
0
        internal Asn1OctetString(
            Asn1Encodable obj)
        {
            try
            {
				this.str = obj.GetEncoded(Asn1Encodable.Der);
            }
            catch (IOException e)
            {
                throw new ArgumentException("Error processing object : " + e.ToString());
            }
        }
コード例 #19
0
		public TypeOfBiometricData(
			int predefinedBiometricType)
        {
            if (predefinedBiometricType == Picture || predefinedBiometricType == HandwrittenSignature)
            {
                obj = new DerInteger(predefinedBiometricType);
            }
            else
            {
                throw new ArgumentException("unknow PredefinedBiometricType : " + predefinedBiometricType);
            }
        }
コード例 #20
0
    /**
        * 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();
			}
        }
コード例 #21
0
		public SmimeCapability(
            DerObjectIdentifier	capabilityID,
            Asn1Encodable		parameters)
        {
			if (capabilityID == null)
				throw new ArgumentNullException("capabilityID");

			this.capabilityID = capabilityID;

			if (parameters != null)
			{
				this.parameters = parameters.ToAsn1Object();
			}
        }
コード例 #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;
            }
        }
コード例 #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();
			}
		}
コード例 #24
0
		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;
			}
		}
コード例 #25
0
		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);
		}
コード例 #26
0
 /**
  * @param tagNo the tag number for this object.
  * @param obj the tagged object.
  */
 public BerTaggedObject(
     int tagNo,
     Asn1Encodable obj)
     : base(tagNo, obj)
 {
 }
コード例 #27
0
ファイル: BERGenerator.cs プロジェクト: mjsir911/Disa-XMPP
 public override void AddObject(
     Asn1Encodable obj)
 {
     new BerOutputStream(Out).WriteObject(obj);
 }
コード例 #28
0
ファイル: Asn1Set.cs プロジェクト: Xanagandr/DisaOpenSource
		public virtual Asn1Encodable[] ToArray()
		{
			Asn1Encodable[] values = new Asn1Encodable[this.Count];
			for (int i = 0; i < this.Count; ++i)
			{
				values[i] = this[i];
			}
			return values;
		}
コード例 #29
0
ファイル: Asn1Set.cs プロジェクト: Xanagandr/DisaOpenSource
		protected internal void AddObject(
			Asn1Encodable obj)
        {
            _set.Add(obj);
        }
コード例 #30
0
 protected internal void AddObject(
     Asn1Encodable obj)
 {
     _set.Add(obj);
 }
コード例 #31
0
        /**
         * @param obj - a single object that makes up the set.
         */

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