internal 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;
        }
 public DHKdfParameters(
     DerObjectIdentifier	algorithm,
     int					keySize,
     byte[]				z)
     : this(algorithm, keySize, z, null)
 {
 }
 public ContentInfo(
     DerObjectIdentifier	contentType,
     Asn1Encodable		content)
 {
     this.contentType = contentType;
     this.content = content;
 }
 public AttributePkcs(
     DerObjectIdentifier	attrType,
     Asn1Set				attrValues)
 {
     this.attrType = attrType;
     this.attrValues = attrValues;
 }
 public Gost3410KeyGenerationParameters(
     SecureRandom		random,
     DerObjectIdentifier	publicKeyParamSet)
     : this(random, LookupParameters(publicKeyParamSet))
 {
     this.publicKeyParamSet = publicKeyParamSet;
 }
 public OtherKeyAttribute(
     DerObjectIdentifier	keyAttrId,
     Asn1Encodable		keyAttr)
 {
     this.keyAttrId = keyAttrId;
     this.keyAttr = keyAttr;
 }
 public ECKeyGenerationParameters(
     DerObjectIdentifier	publicKeyParamSet,
     SecureRandom		random)
     : this(ECKeyParameters.LookupParameters(publicKeyParamSet), random)
 {
     this.publicKeyParamSet = publicKeyParamSet;
 }
 public DHPrivateKeyParameters(
     BigInteger			x,
     DHParameters		parameters,
     DerObjectIdentifier	algorithmOid)
     : base(true, parameters, algorithmOid)
 {
     this.x = x;
 }
Example #9
0
 public SafeBag(
     DerObjectIdentifier	oid,
     Asn1Object			obj)
 {
     this.bagID = oid;
     this.bagValue = obj;
     this.bagAttributes = null;
 }
 protected Gost3410KeyParameters(
     bool				isPrivate,
     DerObjectIdentifier	publicKeyParamSet)
     : base(isPrivate)
 {
     this.parameters = LookupParameters(publicKeyParamSet);
     this.publicKeyParamSet = publicKeyParamSet;
 }
        public virtual void Init(IDerivationParameters param)
        {
            DHKdfParameters parameters = (DHKdfParameters)param;

            this.algorithm = parameters.Algorithm;
            this.keySize = parameters.KeySize;
            this.z = parameters.GetZ(); // TODO Clone?
        }
        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]);
        }
Example #13
0
 public SafeBag(
     DerObjectIdentifier	oid,
     Asn1Object			obj,
     Asn1Set				bagAttributes)
 {
     this.bagID = oid;
     this.bagValue = obj;
     this.bagAttributes = bagAttributes;
 }
Example #14
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]);
        }
        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]);
        }
 public EncryptedContentInfo(
     DerObjectIdentifier	contentType,
     AlgorithmIdentifier	contentEncryptionAlgorithm,
     Asn1OctetString		encryptedContent)
 {
     this.contentType = contentType;
     this.contentEncryptionAlgorithm = contentEncryptionAlgorithm;
     this.encryptedContent = encryptedContent;
 }
Example #17
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]);
        }
Example #18
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 Gost3410PublicKeyParameters(
            BigInteger			y,
            DerObjectIdentifier publicKeyParamSet)
            : base(false, publicKeyParamSet)
        {
            if (y.SignValue < 1 || y.CompareTo(Parameters.P) >= 0)
                throw new ArgumentException("Invalid y for GOST3410 public key", "y");

            this.y = y;
        }
        public ECPrivateKeyParameters(
            BigInteger			d,
            DerObjectIdentifier publicKeyParamSet)
            : base("ECGOST3410", true, publicKeyParamSet)
        {
            if (d == null)
                throw new ArgumentNullException("d");

            this.d = d;
        }
        private ContentInfo(
            Asn1Sequence seq)
        {
            contentType = (DerObjectIdentifier) seq[0];

            if (seq.Count > 1)
            {
                content = ((Asn1TaggedObject) seq[1]).GetObject();
            }
        }
        public ECPublicKeyParameters(
            ECPoint				q,
            DerObjectIdentifier publicKeyParamSet)
            : base("ECGOST3410", false, publicKeyParamSet)
        {
            if (q == null)
                throw new ArgumentNullException("q");

            this.q = q.Normalize();
        }
        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;
        }
 protected DHKeyParameters(
     bool				isPrivate,
     DHParameters		parameters,
     DerObjectIdentifier	algorithmOid)
     : base(isPrivate)
 {
     // TODO Should we allow parameters to be null?
     this.parameters = parameters;
     this.algorithmOid = algorithmOid;
 }
        public SmimeCapability(
            Asn1Sequence seq)
        {
            capabilityID = (DerObjectIdentifier) seq[0].ToAsn1Object();

            if (seq.Count > 1)
            {
                parameters = seq[1].ToAsn1Object();
            }
        }
        public DHPublicKeyParameters(
            BigInteger			y,
            DHParameters		parameters,
            DerObjectIdentifier	algorithmOid)
            : base(false, parameters, algorithmOid)
        {
            if (y == null)
                throw new ArgumentNullException("y");

            this.y = y;
        }
        public ECPrivateKeyParameters(
            string				algorithm,
            BigInteger			d,
            DerObjectIdentifier publicKeyParamSet)
            : base(algorithm, true, publicKeyParamSet)
        {
            if (d == null)
                throw new ArgumentNullException("d");

            this.d = d;
        }
        public ECPublicKeyParameters(
            string				algorithm,
            ECPoint				q,
            DerObjectIdentifier publicKeyParamSet)
            : base(algorithm, false, publicKeyParamSet)
        {
            if (q == null)
                throw new ArgumentNullException("q");

            this.q = q.Normalize();
        }
        public Gost3410PublicKeyAlgParameters(
            Asn1Sequence seq)
        {
            this.publicKeyParamSet = (DerObjectIdentifier) seq[0];
            this.digestParamSet = (DerObjectIdentifier) seq[1];

            if (seq.Count > 2)
            {
                this.encryptionParamSet = (DerObjectIdentifier) seq[2];
            }
        }
 public DHKdfParameters(
     DerObjectIdentifier algorithm,
     int keySize,
     byte[] z,
     byte[] extraInfo)
 {
     this.algorithm = algorithm;
     this.keySize = keySize;
     this.z = z; // TODO Clone?
     this.extraInfo = extraInfo;
 }