コード例 #1
0
ファイル: Evidence.cs プロジェクト: KimikoMuffin/bc-csharp
		private Evidence(Asn1TaggedObject tagged)
		{
			if (tagged.TagNo == 0)
			{
				this.tstEvidence = TimeStampTokenEvidence.GetInstance(tagged, false);
			}
		}
コード例 #2
0
ファイル: PopoPrivKey.cs プロジェクト: htlp/itextsharp
        private PopoPrivKey(Asn1TaggedObject obj)
        {
            this.tagNo = obj.TagNo;

            switch (tagNo)
            {
            case thisMessage:
                this.obj = DerBitString.GetInstance(obj, false);
                break;
            case subsequentMessage:
                this.obj = SubsequentMessage.ValueOf(DerInteger.GetInstance(obj, false).Value.IntValue);
                break;
            case dhMAC:
                this.obj = DerBitString.GetInstance(obj, false);
                break;
            case agreeMAC:
                this.obj = PKMacValue.GetInstance(obj, false);
                break;
            case encryptedKey:
                this.obj = EnvelopedData.GetInstance(obj, false);
                break;
            default:
                throw new ArgumentException("unknown tag in PopoPrivKey", "obj");
            }
        }
コード例 #3
0
        private DeclarationOfMajority(
			Asn1TaggedObject o)
        {
            if (o.TagNo > 2)
                throw new ArgumentException("Bad tag number: " + o.TagNo);

            this.declaration = o;
        }
コード例 #4
0
		public static RequestedCertificate GetInstance(
			Asn1TaggedObject	obj,
			bool				isExplicit)
		{
			if (!isExplicit)
				throw new ArgumentException("choice item must be explicitly tagged");

			return GetInstance(obj.GetObject());
		}
コード例 #5
0
		public static DirectoryString GetInstance(
			Asn1TaggedObject	obj,
			bool				isExplicit)
		{
			if (!isExplicit)
				throw new ArgumentException("choice item must be explicitly tagged");

			return GetInstance(obj.GetObject());
		}
コード例 #6
0
		/**
         * return an OriginatorIdentifierOrKey object from a tagged object.
         *
         * @param o the tagged object holding the object we want.
         * @param explicitly true if the object is meant to be explicitly
         *              tagged false otherwise.
         * @exception ArgumentException if the object held by the
         *          tagged object cannot be converted.
         */
        public static OriginatorIdentifierOrKey GetInstance(
            Asn1TaggedObject	o,
            bool				explicitly)
        {
            if (!explicitly)
            {
                throw new ArgumentException(
                        "Can't implicitly tag OriginatorIdentifierOrKey");
            }

			return GetInstance(o.GetObject());
        }
コード例 #7
0
		public DistributionPointName(
            Asn1TaggedObject obj)
        {
            this.type = obj.TagNo;

			if (type == FullName)
            {
                this.name = GeneralNames.GetInstance(obj, false);
            }
            else
            {
                this.name = Asn1Set.GetInstance(obj, false);
            }
        }
コード例 #8
0
		private CertOrEncCert(Asn1TaggedObject tagged)
		{
			if (tagged.TagNo == 0)
			{
				certificate = CmpCertificate.GetInstance(tagged.GetObject());
			}
			else if (tagged.TagNo == 1)
			{
				encryptedCert = EncryptedValue.GetInstance(tagged.GetObject());
			}
			else
			{
				throw new ArgumentException("unknown tag: " + tagged.TagNo, "tagged");
			}
		}
コード例 #9
0
ファイル: Target.cs プロジェクト: ktw/OutlookPrivacyPlugin
		/**
		 * Constructor from Asn1TaggedObject.
		 * 
		 * @param tagObj The tagged object.
		 * @throws ArgumentException if the encoding is wrong.
		 */
		private Target(
			Asn1TaggedObject tagObj)
		{
			switch ((Choice) tagObj.TagNo)
			{
				case Choice.Name:	// GeneralName is already a choice so explicit
					targetName = GeneralName.GetInstance(tagObj, true);
					break;
				case Choice.Group:
					targetGroup = GeneralName.GetInstance(tagObj, true);
					break;
				default:
					throw new ArgumentException("unknown tag: " + tagObj.TagNo);
			}
		}
コード例 #10
0
		private RequestedCertificate(
			Asn1TaggedObject tagged)
		{
			switch ((Choice) tagged.TagNo)
			{
				case Choice.AttributeCertificate:
					this.attributeCert = Asn1OctetString.GetInstance(tagged, true).GetOctets();
					break;
				case Choice.PublicKeyCertificate:
					this.publicKeyCert = Asn1OctetString.GetInstance(tagged, true).GetOctets();
					break;
				default:
					throw new ArgumentException("unknown tag number: " + tagged.TagNo);
			}
		}
コード例 #11
0
ファイル: CertStatus.cs プロジェクト: KimikoMuffin/bc-csharp
		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;
            }
        }
コード例 #12
0
ファイル: Holder.cs プロジェクト: KimikoMuffin/bc-csharp
		/**
		 * Constructor for a holder for an v1 attribute certificate.
		 * 
		 * @param tagObj The ASN.1 tagged holder object.
		 */
		public Holder(
			Asn1TaggedObject tagObj)
		{
			switch (tagObj.TagNo)
			{
				case 0:
					baseCertificateID = IssuerSerial.GetInstance(tagObj, false);
					break;
				case 1:
					entityName = GeneralNames.GetInstance(tagObj, false);
					break;
				default:
					throw new ArgumentException("unknown tag in Holder");
			}

			this.version = 0;
		}
コード例 #13
0
 private PkiArchiveOptions(Asn1TaggedObject tagged)
 {
     switch (tagged.TagNo)
     {
         case encryptedPrivKey:
             value = EncryptedKey.GetInstance(tagged.GetObject());
             break;
         case keyGenParameters:
             value = Asn1OctetString.GetInstance(tagged, false);
             break;
         case archiveRemGenPrivKey:
             value = DerBoolean.GetInstance(tagged, false);
             break;
         default:
             throw new ArgumentException("unknown tag number: " + tagged.TagNo, "tagged");
     }
 }
コード例 #14
0
ファイル: CertStatus.cs プロジェクト: bcgit/bc-csharp
		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;
				default:
					throw new ArgumentException("Unknown tag encountered: " + choice.TagNo);
            }
        }
コード例 #15
0
 private ProofOfPossession(Asn1TaggedObject tagged)
 {
     tagNo = tagged.TagNo;
     switch (tagNo)
     {
     case 0:
         obj = DerNull.Instance;
         break;
     case 1:
         obj = PopoSigningKey.GetInstance(tagged, false);
         break;
     case 2:
     case 3:
         obj = PopoPrivKey.GetInstance(tagged, false);
         break;
     default:
         throw new ArgumentException("unknown tag: " + tagNo, "tagged");
     }
 }
コード例 #16
0
		public DeclarationOfMajority(
			bool	fullAge,
			string	country)
		{
			if (country.Length > 2)
				throw new ArgumentException("country can only be 2 characters");

			DerPrintableString countryString = new DerPrintableString(country, true);

			DerSequence seq;
			if (fullAge)
			{
				seq = new DerSequence(countryString);
			}
			else
			{
				seq = new DerSequence(DerBoolean.False, countryString);
			}

			this.declaration = new DerTaggedObject(false, 1, seq);
		}
コード例 #17
0
 /// <summary>
 /// Gets the instance.
 /// </summary>
 /// <param name="obj">The object.</param>
 /// <param name="explicitly">if set to <c>true</c> [explicitly].</param>
 /// <returns></returns>
 public static FreshestCRL GetInstance(
     Asn1TaggedObject obj,
     bool explicitly)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, explicitly)));
 }
コード例 #18
0
 public DeclarationOfMajority(
     DerGeneralizedTime dateOfBirth)
 {
     this.declaration = new DerTaggedObject(false, 2, dateOfBirth);
 }
コード例 #19
0
 /**
  * return an RecipientEncryptedKey object from a tagged object.
  *
  * @param obj the tagged object holding the object we want.
  * @param isExplicit true if the object is meant to be explicitly
  *              tagged false otherwise.
  * @exception ArgumentException if the object held by the
  *          tagged object cannot be converted.
  */
 public static RecipientEncryptedKey GetInstance(
     Asn1TaggedObject obj,
     bool isExplicit)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, isExplicit)));
 }
コード例 #20
0
 public static CertificatePolicies GetInstance(Asn1TaggedObject obj, bool isExplicit)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, isExplicit)));
 }
コード例 #21
0
 public static DHDomainParameters GetInstance(Asn1TaggedObject obj, bool isExplicit)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, isExplicit)));
 }
コード例 #22
0
ファイル: Time.cs プロジェクト: NicolasDorier/bc-csharp
 public static Time GetInstance(
     Asn1TaggedObject	obj,
     bool				explicitly)
 {
     return GetInstance(obj.GetObject());
 }
コード例 #23
0
ファイル: ContentInfo.cs プロジェクト: flobecker/trudi-koala
 public static ContentInfo GetInstance(Asn1TaggedObject obj, bool isExplicit)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, isExplicit)));
 }
コード例 #24
0
 public static RsaPublicKeyStructure GetInstance(
     Asn1TaggedObject obj,
     bool explicitly)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, explicitly)));
 }
コード例 #25
0
ファイル: BasicConstraints.cs プロジェクト: wizd/bc-csharp
 public static BasicConstraints GetInstance(
     Asn1TaggedObject obj,
     bool explicitly)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, explicitly)));
 }
コード例 #26
0
 /**
  * return a RecipientKeyIdentifier object from a tagged object.
  *
  * @param _ato the tagged object holding the object we want.
  * @param _explicit true if the object is meant to be explicitly
  *              tagged false otherwise.
  * @exception ArgumentException if the object held by the
  *          tagged object cannot be converted.
  */
 public static RecipientKeyIdentifier GetInstance(
     Asn1TaggedObject ato,
     bool explicitly)
 {
     return(GetInstance(Asn1Sequence.GetInstance(ato, explicitly)));
 }
コード例 #27
0
        internal TbsCertificateStructure(
            Asn1Sequence seq)
        {
            int seqStart = 0;

            this.seq = seq;

            //
            // some certficates don't include a version number - we assume v1
            //
            if (seq[0] is Asn1TaggedObject)
            {
                version = DerInteger.GetInstance((Asn1TaggedObject)seq[0], true);
            }
            else
            {
                seqStart = -1;                          // field 0 is missing!
                version  = new DerInteger(0);
            }

            bool isV1 = false;
            bool isV2 = false;

            if (version.Value.Equals(BigInteger.Zero))
            {
                isV1 = true;
            }
            else if (version.Value.Equals(BigInteger.One))
            {
                isV2 = true;
            }
            else if (!version.Value.Equals(BigInteger.Two))
            {
                throw new ArgumentException("version number not recognised");
            }

            serialNumber = DerInteger.GetInstance(seq[seqStart + 1]);

            signature = AlgorithmIdentifier.GetInstance(seq[seqStart + 2]);
            issuer    = X509Name.GetInstance(seq[seqStart + 3]);

            //
            // before and after dates
            //
            Asn1Sequence dates = (Asn1Sequence)seq[seqStart + 4];

            startDate = Time.GetInstance(dates[0]);
            endDate   = Time.GetInstance(dates[1]);

            subject = X509Name.GetInstance(seq[seqStart + 5]);

            //
            // public key info.
            //
            subjectPublicKeyInfo = SubjectPublicKeyInfo.GetInstance(seq[seqStart + 6]);

            int extras = seq.Count - (seqStart + 6) - 1;

            if (extras != 0 && isV1)
            {
                throw new ArgumentException("version 1 certificate contains extra data");
            }

            while (extras > 0)
            {
                Asn1TaggedObject extra = Asn1TaggedObject.GetInstance(seq[seqStart + 6 + extras]);
                switch (extra.TagNo)
                {
                case 1:
                {
                    issuerUniqueID = DerBitString.GetInstance(extra, false);
                    break;
                }

                case 2:
                {
                    subjectUniqueID = DerBitString.GetInstance(extra, false);
                    break;
                }

                case 3:
                {
                    if (isV2)
                    {
                        throw new ArgumentException("version 2 certificate cannot contain extensions");
                    }

                    extensions = X509Extensions.GetInstance(Asn1Sequence.GetInstance(extra, true));
                    break;
                }

                default:
                {
                    throw new ArgumentException("Unknown tag encountered in structure: " + extra.TagNo);
                }
                }
                extras--;
            }
        }
コード例 #28
0
 public static PopoPrivKey GetInstance(Asn1TaggedObject tagged, bool isExplicit)
 {
     return(new PopoPrivKey(Asn1TaggedObject.GetInstance(tagged.GetObject())));
 }
コード例 #29
0
 /**
  * Return a X509Name based on the passed in tagged object.
  *
  * @param obj tag object holding name.
  * @param explicitly true if explicitly tagged false otherwise.
  * @return the X509Name
  */
 public static X509Name GetInstance(
     Asn1TaggedObject obj,
     bool explicitly)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, explicitly)));
 }
コード例 #30
0
 public static PKMacValue GetInstance(Asn1TaggedObject obj, bool isExplicit)
 {
     return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
 }
コード例 #31
0
ファイル: ExtendedKeyUsage.cs プロジェクト: htlp/itextsharp
		public static ExtendedKeyUsage GetInstance(
            Asn1TaggedObject	obj,
            bool				explicitly)
        {
            return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
        }
コード例 #32
0
 public static OcspRequest GetInstance(
     Asn1TaggedObject obj,
     bool explicitly)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, explicitly)));
 }
コード例 #33
0
		public static ResponseBytes GetInstance(
			Asn1TaggedObject	obj,
			bool				explicitly)
		{
			return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
		}
コード例 #34
0
ファイル: ResponderID.cs プロジェクト: vincent-deng/Payment
 public static ResponderID GetInstance(
     Asn1TaggedObject obj,
     bool isExplicit)
 {
     return(GetInstance(obj.GetObject()));            // must be explicitly tagged
 }
コード例 #35
0
 public static CrlDistPoint GetInstance(
     Asn1TaggedObject obj,
     bool explicitly)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, explicitly)));
 }
コード例 #36
0
 public static AlgorithmIdentifier GetInstance(
     Asn1TaggedObject obj,
     bool explicitly)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, explicitly)));
 }
コード例 #37
0
 public static AttributeCertificateInfo GetInstance(
     Asn1TaggedObject obj,
     bool isExplicit)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, isExplicit)));
 }
コード例 #38
0
 public static X509CertificateStructure GetInstance(
     Asn1TaggedObject obj,
     bool explicitly)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, explicitly)));
 }
コード例 #39
0
		/**
		 * return an AuthenticatedData object from a tagged object.
		 *
		 * @param obj      the tagged object holding the object we want.
		 * @param isExplicit true if the object is meant to be explicitly
		 *                 tagged false otherwise.
		 * @throws ArgumentException if the object held by the
		 *                                  tagged object cannot be converted.
		 */
		public static AuthenticatedData GetInstance(
			Asn1TaggedObject	obj,
			bool				isExplicit)
		{
			return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
		}
コード例 #40
0
 public static DHPublicKey GetInstance(Asn1TaggedObject obj, bool isExplicit)
 {
     return(GetInstance(DerInteger.GetInstance(obj, isExplicit)));
 }
コード例 #41
0
 public static DHValidationParms GetInstance(Asn1TaggedObject obj, bool isExplicit)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, isExplicit)));
 }
コード例 #42
0
		/**
		 * return an AuthEnvelopedData object from a tagged object.
		 *
		 * @param obj      the tagged object holding the object we want.
		 * @param isExplicit true if the object is meant to be explicitly
		 *                 tagged false otherwise.
		 * @throws ArgumentException if the object held by the
		 *                                  tagged object cannot be converted.
		 */
		public static MQVuserKeyingMaterial GetInstance(
			Asn1TaggedObject	obj,
			bool				isExplicit)
		{
			return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
		}
コード例 #43
0
 public static Time GetInstance(
     Asn1TaggedObject obj,
     bool explicitly)
 {
     return(GetInstance(obj.GetObject()));
 }
コード例 #44
0
ファイル: RecipientInfo.cs プロジェクト: vincent-deng/Payment
 private KekRecipientInfo GetKekInfo(
     Asn1TaggedObject o)
 {
     // For compatibility with erroneous version, we don't always pass 'false' here
     return(KekRecipientInfo.GetInstance(o, o.IsExplicit()));
 }
コード例 #45
0
ファイル: GeneralNames.cs プロジェクト: hjgode/iTextSharpCF
 public static GeneralNames GetInstance(
     Asn1TaggedObject	obj,
     bool				explicitly)
 {
     return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
 }
コード例 #46
0
 public static Gost3410PublicKeyAlgParameters GetInstance(
     Asn1TaggedObject obj,
     bool explicitly)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, explicitly)));
 }
コード例 #47
0
 /**
  * return an RecipientEncryptedKey object from a tagged object.
  *
  * @param obj the tagged object holding the object we want.
  * @param isExplicit true if the object is meant to be explicitly
  *              tagged false otherwise.
  * @exception ArgumentException if the object held by the
  *          tagged object cannot be converted.
  */
 public static RecipientEncryptedKey GetInstance(
     Asn1TaggedObject	obj,
     bool				isExplicit)
 {
     return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
 }
コード例 #48
0
		public static GeneralName GetInstance(
            Asn1TaggedObject	tagObj,
            bool				explicitly)
        {
            return GetInstance(Asn1TaggedObject.GetInstance(tagObj, true));
        }
コード例 #49
0
 public static AlgorithmIdentifier GetInstance(
     Asn1TaggedObject	obj,
     bool				explicitly)
 {
     return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
 }
コード例 #50
0
        /**
         * Gets a String from an ASN1Primitive
         * @param names the ASN1Primitive
         * @return  a human-readable String
         * @throws IOException
         */
        private static String GetStringFromGeneralName(Asn1Object names)
        {
            Asn1TaggedObject taggedObject = (Asn1TaggedObject)names;

            return(Encoding.GetEncoding(1252).GetString(Asn1OctetString.GetInstance(taggedObject, false).GetOctets()));
        }
コード例 #51
0
		public static DHValidationParms GetInstance(Asn1TaggedObject obj, bool isExplicit)
		{
			return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
		}
コード例 #52
0
ファイル: ResponseData.cs プロジェクト: wnf0000/NBitcoin
 public static ResponseData GetInstance(
     Asn1TaggedObject obj,
     bool explicitly)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, explicitly)));
 }
コード例 #53
0
ファイル: DigestInfo.cs プロジェクト: KimikoMuffin/bc-csharp
		public static DigestInfo GetInstance(
            Asn1TaggedObject	obj,
            bool				explicitly)
        {
            return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
        }
コード例 #54
0
 public static NamingAuthority GetInstance(
     Asn1TaggedObject obj,
     bool isExplicit)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, isExplicit)));
 }
コード例 #55
0
 /**
  * return a OtherRevocationInfoFormat object from a tagged object.
  *
  * @param obj the tagged object holding the object we want.
  * @param explicit true if the object is meant to be explicitly
  *              tagged false otherwise.
  * @exception IllegalArgumentException if the object held by the
  *          tagged object cannot be converted.
  */
 public static OtherRevocationInfoFormat GetInstance(Asn1TaggedObject obj, bool isExplicit)
 {
     return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
 }
コード例 #56
0
 public static CertId GetInstance(Asn1TaggedObject obj, bool isExplicit)
 {
     return(CertId.GetInstance(Asn1Sequence.GetInstance(obj, isExplicit)));
 }
コード例 #57
0
 /**
  * return a KekRecipientInfo object from a tagged object.
  *
  * @param obj the tagged object holding the object we want.
  * @param explicitly true if the object is meant to be explicitly
  *              tagged false otherwise.
  * @exception ArgumentException if the object held by the
  *          tagged object cannot be converted.
  */
 public static KekRecipientInfo GetInstance(
     Asn1TaggedObject obj,
     bool explicitly)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, explicitly)));
 }
コード例 #58
0
ファイル: GeneralName.cs プロジェクト: todoasap/bc-csharp
 public static GeneralName GetInstance(
     Asn1TaggedObject tagObj,
     bool explicitly)
 {
     return(GetInstance(Asn1TaggedObject.GetInstance(tagObj, true)));
 }
コード例 #59
0
        public static TbsCertificateStructure GetInstance(
			Asn1TaggedObject	obj,
			bool				explicitly)
        {
            return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
        }
コード例 #60
0
 /**
  * return an AuthenticatedData object from a tagged object.
  *
  * @param obj      the tagged object holding the object we want.
  * @param isExplicit true if the object is meant to be explicitly
  *                 tagged false otherwise.
  * @throws ArgumentException if the object held by the
  *                                  tagged object cannot be converted.
  */
 public static AuthenticatedData GetInstance(
     Asn1TaggedObject obj,
     bool isExplicit)
 {
     return(GetInstance(Asn1Sequence.GetInstance(obj, isExplicit)));
 }