Org.BouncyCastle.Asn1.Cms.OtherKeyAttribute.GetInstance C# (CSharp) Méthode

GetInstance() public static méthode

public static GetInstance ( object obj ) : OtherKeyAttribute
obj object
Résultat OtherKeyAttribute
        public static OtherKeyAttribute GetInstance(
            object obj)
        {
            if (obj == null || obj is OtherKeyAttribute)
            {
                return (OtherKeyAttribute) obj;
            }

			if (obj is Asn1Sequence)
            {
                return new OtherKeyAttribute((Asn1Sequence) obj);
            }

			throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj");
        }

Usage Example

        public RecipientKeyIdentifier(
            Asn1Sequence seq)
        {
            subjectKeyIdentifier = Asn1OctetString.GetInstance(
                seq[0]);

            switch (seq.Count)
            {
            case 1:
                break;

            case 2:
                if (seq[1] is DerGeneralizedTime)
                {
                    date = (DerGeneralizedTime)seq[1];
                }
                else
                {
                    other = OtherKeyAttribute.GetInstance(seq[2]);
                }
                break;

            case 3:
                date  = (DerGeneralizedTime)seq[1];
                other = OtherKeyAttribute.GetInstance(seq[2]);
                break;

            default:
                throw new ArgumentException("Invalid RecipientKeyIdentifier");
            }
        }
All Usage Examples Of Org.BouncyCastle.Asn1.Cms.OtherKeyAttribute::GetInstance