예제 #1
0
		public DerObjectIdentifier(DerObjectIdentifier oid, string branchID)
		{
			if(!IsValidBranchID(branchID, 0))
				throw new ArgumentException("string " + branchID + " not a valid OID branch", "branchID");

			this.identifier = oid.Id + "." + branchID;
		}
예제 #2
0
        /**
         * returns an ArrayList with 0 or more objects of all the capabilities
         * matching the passed in capability Oid. If the Oid passed is null the
         * entire set is returned.
         */
        public IList GetCapabilitiesForOid(
            DerObjectIdentifier capability)
        {
            IList list = Platform.CreateArrayList();
            DoGetCapabilitiesForOid(capability, list);
			return list;
        }
예제 #3
0
 public ContentInfo(
     DerObjectIdentifier	contentType,
     Asn1Encodable		content)
 {
     this.contentType = contentType;
     this.content = content;
 }
예제 #4
0
        public ArrayList GetCapabilities(
            DerObjectIdentifier capability)
        {
            ArrayList list = new ArrayList();
            DoGetCapabilitiesForOid(capability, list);
			return list;
        }
예제 #5
0
		public OtherKeyAttribute(
            DerObjectIdentifier	keyAttrId,
            Asn1Encodable		keyAttr)
        {
            this.keyAttrId = keyAttrId;
            this.keyAttr = keyAttr;
        }
		public Gost3410KeyGenerationParameters(
			SecureRandom		random,
			DerObjectIdentifier	publicKeyParamSet)
			: this(random, LookupParameters(publicKeyParamSet))
		{
			this.publicKeyParamSet = publicKeyParamSet;
		}
예제 #7
0
		public AttributeX509(
            DerObjectIdentifier	attrType,
            Asn1Set				attrValues)
        {
            this.attrType = attrType;
            this.attrValues = attrValues;
        }
예제 #8
0
 private static void DefineCurve(
     string				name,
     DerObjectIdentifier	oid)
 {
     objIds.Add(name, oid);
     names.Add(oid, name);
 }
예제 #9
0
		public DHKdfParameters(
			DerObjectIdentifier	algorithm,
			int					keySize,
			byte[]				z)
			: this(algorithm, keySize, z, null)
		{
		}
		public ECKeyGenerationParameters(
			DerObjectIdentifier	publicKeyParamSet,
			SecureRandom		random)
			: this(ECKeyParameters.LookupParameters(publicKeyParamSet), random)
		{
			this.publicKeyParamSet = publicKeyParamSet;
		}
예제 #11
0
		public SafeBag(
            DerObjectIdentifier	oid,
            Asn1Object			obj)
        {
            this.bagID = oid;
            this.bagValue = obj;
            this.bagAttributes = null;
        }
예제 #12
0
		public DHPrivateKeyParameters(
            BigInteger			x,
            DHParameters		parameters,
		    DerObjectIdentifier	algorithmOid)
			: base(true, parameters, algorithmOid)
        {
            this.x = x;
        }
예제 #13
0
		protected Gost3410KeyParameters(
			bool				isPrivate,
			DerObjectIdentifier	publicKeyParamSet)
			: base(isPrivate)
		{
			this.parameters = LookupParameters(publicKeyParamSet);
			this.publicKeyParamSet = publicKeyParamSet;
		}
예제 #14
0
        public virtual void Init(IDerivationParameters param)
        {
            DHKdfParameters parameters = (DHKdfParameters)param;

            this.algorithm = parameters.Algorithm;
            this.keySize = parameters.KeySize;
            this.z = parameters.GetZ(); // TODO Clone?
        }
예제 #15
0
		private AttributePkcs(
            Asn1Sequence seq)
        {
			if (seq.Count != 2)
				throw new ArgumentException("Wrong number of elements in sequence", "seq");

			attrType = DerObjectIdentifier.GetInstance(seq[0]);
            attrValues = Asn1Set.GetInstance(seq[1]);
        }
예제 #16
0
		private ResponseBytes(
            Asn1Sequence seq)
        {
			if (seq.Count != 2)
				throw new ArgumentException("Wrong number of elements in sequence", "seq");

			this.responseType = DerObjectIdentifier.GetInstance(seq[0]);
            this.response = Asn1OctetString.GetInstance(seq[1]);
        }
예제 #17
0
		public SafeBag(
            DerObjectIdentifier	oid,
            Asn1Object			obj,
            Asn1Set				bagAttributes)
        {
            this.bagID = oid;
            this.bagValue = obj;
            this.bagAttributes = bagAttributes;
        }
예제 #18
0
		private AttributeX509(
            Asn1Sequence seq)
        {
			if (seq.Count != 2)
				throw new ArgumentException("Bad sequence size: " + seq.Count);

			attrType = DerObjectIdentifier.GetInstance(seq[0]);
			attrValues = Asn1Set.GetInstance(seq[1]);
        }
예제 #19
0
        private Gost28147Parameters(
            Asn1Sequence seq)
        {
			if (seq.Count != 2)
				throw new ArgumentException("Wrong number of elements in sequence", "seq");

			this.iv = Asn1OctetString.GetInstance(seq[0]);
			this.paramSet = DerObjectIdentifier.GetInstance(seq[1]);
        }
예제 #20
0
		public EncryptedContentInfo(
            DerObjectIdentifier	contentType,
            AlgorithmIdentifier	contentEncryptionAlgorithm,
            Asn1OctetString		encryptedContent)
        {
            this.contentType = contentType;
            this.contentEncryptionAlgorithm = contentEncryptionAlgorithm;
            this.encryptedContent = encryptedContent;
        }
예제 #21
0
		protected DHKeyParameters(
            bool				isPrivate,
            DHParameters		parameters,
			DerObjectIdentifier	algorithmOid)
			: base(isPrivate)
        {
			// TODO Should we allow parameters to be null?
            this.parameters = parameters;
			this.algorithmOid = algorithmOid;
        }
예제 #22
0
        public ECPublicKeyParameters(
            ECPoint				q,
            DerObjectIdentifier publicKeyParamSet)
            : base("ECGOST3410", false, publicKeyParamSet)
        {
            if (q == null)
                throw new ArgumentNullException("q");

            this.q = q.Normalize();
        }
예제 #23
0
        private ContentInfo(
            Asn1Sequence seq)
        {
            contentType = (DerObjectIdentifier) seq[0];

            if (seq.Count > 1)
            {
                content = ((Asn1TaggedObject) seq[1]).GetObject();
            }
        }
예제 #24
0
        public ECPrivateKeyParameters(
            BigInteger			d,
            DerObjectIdentifier publicKeyParamSet)
            : base("ECGOST3410", true, publicKeyParamSet)
        {
            if (d == null)
                throw new ArgumentNullException("d");

            this.d = d;
        }
예제 #25
0
		public SafeBag(
            Asn1Sequence seq)
        {
            this.bagID = (DerObjectIdentifier) seq[0];
            this.bagValue = ((DerTaggedObject) seq[1]).GetObject();
            if (seq.Count == 3)
            {
                this.bagAttributes = (Asn1Set) seq[2];
            }
        }
		public Gost3410PrivateKeyParameters(
			BigInteger			x,
			DerObjectIdentifier	publicKeyParamSet)
			: base(true, publicKeyParamSet)
		{
			if (x.SignValue < 1 || x.BitLength > 256 || x.CompareTo(Parameters.Q) >= 0)
				throw new ArgumentException("Invalid x for GOST3410 private key", "x");

			this.x = x;
		}
예제 #27
0
		public SmimeCapability(
            Asn1Sequence seq)
        {
            capabilityID = (DerObjectIdentifier) seq[0].ToAsn1Object();

			if (seq.Count > 1)
            {
                parameters = seq[1].ToAsn1Object();
            }
        }
예제 #28
0
		public DHKdfParameters(
			DerObjectIdentifier algorithm,
			int keySize,
			byte[] z,
			byte[] extraInfo)
		{
			this.algorithm = algorithm;
			this.keySize = keySize;
			this.z = z; // TODO Clone?
			this.extraInfo = extraInfo;
		}
예제 #29
0
        public ECPublicKeyParameters(
            string				algorithm,
            ECPoint				q,
            DerObjectIdentifier publicKeyParamSet)
            : base(algorithm, false, publicKeyParamSet)
        {
            if (q == null)
                throw new ArgumentNullException("q");

            this.q = q.Normalize();
        }
예제 #30
0
		public DHPublicKeyParameters(
            BigInteger			y,
            DHParameters		parameters,
		    DerObjectIdentifier	algorithmOid)
			: base(false, parameters, algorithmOid)
        {
			if (y == null)
				throw new ArgumentNullException("y");

			this.y = y;
        }