Наследование: Asn1Encodable
Пример #1
0
        /**
         * <pre>
         *  PKIHeader ::= SEQUENCE {
         *            pvno                INTEGER     { cmp1999(1), cmp2000(2) },
         *            sender              GeneralName,
         *            -- identifies the sender
         *            recipient           GeneralName,
         *            -- identifies the intended recipient
         *            messageTime     [0] GeneralizedTime         OPTIONAL,
         *            -- time of production of this message (used when sender
         *            -- believes that the transport will be "suitable"; i.e.,
         *            -- that the time will still be meaningful upon receipt)
         *            protectionAlg   [1] AlgorithmIdentifier     OPTIONAL,
         *            -- algorithm used for calculation of protection bits
         *            senderKID       [2] KeyIdentifier           OPTIONAL,
         *            recipKID        [3] KeyIdentifier           OPTIONAL,
         *            -- to identify specific keys used for protection
         *            transactionID   [4] OCTET STRING            OPTIONAL,
         *            -- identifies the transaction; i.e., this will be the same in
         *            -- corresponding request, response, certConf, and PKIConf
         *            -- messages
         *            senderNonce     [5] OCTET STRING            OPTIONAL,
         *            recipNonce      [6] OCTET STRING            OPTIONAL,
         *            -- nonces used to provide replay protection, senderNonce
         *            -- is inserted by the creator of this message; recipNonce
         *            -- is a nonce previously inserted in a related message by
         *            -- the intended recipient of this message
         *            freeText        [7] PKIFreeText             OPTIONAL,
         *            -- this may be used to indicate context-specific instructions
         *            -- (this field is intended for human consumption)
         *            generalInfo     [8] SEQUENCE SIZE (1..MAX) OF
         *                                 InfoTypeAndValue     OPTIONAL
         *            -- this may be used to convey context-specific information
         *            -- (this field not primarily intended for human consumption)
         * }
         * </pre>
         * @return a basic ASN.1 object representation.
         */
        public virtual PkiHeader Build()
        {
            Asn1EncodableVector v = new Asn1EncodableVector(pvno, sender, recipient);

            AddOptional(v, 0, messageTime);
            AddOptional(v, 1, protectionAlg);
            AddOptional(v, 2, senderKID);
            AddOptional(v, 3, recipKID);
            AddOptional(v, 4, transactionID);
            AddOptional(v, 5, senderNonce);
            AddOptional(v, 6, recipNonce);
            AddOptional(v, 7, freeText);
            AddOptional(v, 8, generalInfo);

            messageTime   = null;
            protectionAlg = null;
            senderKID     = null;
            recipKID      = null;
            transactionID = null;
            senderNonce   = null;
            recipNonce    = null;
            freeText      = null;
            generalInfo   = null;

            return(PkiHeader.GetInstance(new DerSequence(v)));
        }
Пример #2
0
 public PkiMessage(
     PkiHeader header,
     PkiBody body,
     DerBitString protection)
     : this(header, body, protection, null)
 {
 }
Пример #3
0
        public virtual PkiHeader Build()
        {
            Asn1EncodableVector v = new Asn1EncodableVector(new Asn1Encodable[]
            {
                this.pvno,
                this.sender,
                this.recipient
            });

            this.AddOptional(v, 0, this.messageTime);
            this.AddOptional(v, 1, this.protectionAlg);
            this.AddOptional(v, 2, this.senderKID);
            this.AddOptional(v, 3, this.recipKID);
            this.AddOptional(v, 4, this.transactionID);
            this.AddOptional(v, 5, this.senderNonce);
            this.AddOptional(v, 6, this.recipNonce);
            this.AddOptional(v, 7, this.freeText);
            this.AddOptional(v, 8, this.generalInfo);
            this.messageTime   = null;
            this.protectionAlg = null;
            this.senderKID     = null;
            this.recipKID      = null;
            this.transactionID = null;
            this.senderNonce   = null;
            this.recipNonce    = null;
            this.freeText      = null;
            this.generalInfo   = null;
            return(PkiHeader.GetInstance(new DerSequence(v)));
        }
Пример #4
0
 public PkiMessage(
     PkiHeader header,
     PkiBody body,
     DerBitString protection)
     : this(header, body, protection, null)
 {
 }
Пример #5
0
 public PkiMessage(PkiHeader header, PkiBody body, DerBitString protection, CmpCertificate[] extraCerts)
 {
     this.header     = header;
     this.body       = body;
     this.protection = protection;
     if (extraCerts != null)
     {
         this.extraCerts = new DerSequence(extraCerts);
     }
 }
Пример #6
0
 /**
  * Creates a new PkiMessage.
  *
  * @param header message header
  * @param body message body
  * @param protection message protection (may be null)
  * @param extraCerts extra certificates (may be null)
  */
 public PkiMessage(
     PkiHeader header,
     PkiBody body,
     DerBitString protection,
     CmpCertificate[] extraCerts)
 {
     this.header = header;
     this.body = body;
     this.protection = protection;
     if (extraCerts != null)
     {
         this.extraCerts = new DerSequence(extraCerts);
     }
 }
Пример #7
0
 private PkiMessage(Asn1Sequence seq)
 {
     this.header = PkiHeader.GetInstance(seq[0]);
     this.body   = PkiBody.GetInstance(seq[1]);
     for (int i = 2; i < seq.Count; i++)
     {
         Asn1TaggedObject asn1TaggedObject = (Asn1TaggedObject)seq[i].ToAsn1Object();
         if (asn1TaggedObject.TagNo == 0)
         {
             this.protection = DerBitString.GetInstance(asn1TaggedObject, true);
         }
         else
         {
             this.extraCerts = Asn1Sequence.GetInstance(asn1TaggedObject, true);
         }
     }
 }
Пример #8
0
        private PkiMessage(Asn1Sequence seq)
        {
            header = PkiHeader.GetInstance(seq[0]);
            body   = PkiBody.GetInstance(seq[1]);

            for (int pos = 2; pos < seq.Count; ++pos)
            {
                Asn1TaggedObject tObj = (Asn1TaggedObject)seq[pos].ToAsn1Object();

                if (tObj.TagNo == 0)
                {
                    protection = DerBitString.GetInstance(tObj, true);
                }
                else
                {
                    extraCerts = Asn1Sequence.GetInstance(tObj, true);
                }
            }
        }
Пример #9
0
        private PkiMessage(Asn1Sequence seq)
        {
            header = PkiHeader.GetInstance(seq[0]);
            body = PkiBody.GetInstance(seq[1]);

            for (int pos = 2; pos < seq.Count; ++pos)
            {
                Asn1TaggedObject tObj = (Asn1TaggedObject)seq[pos].ToAsn1Object();

                if (tObj.TagNo == 0)
                {
                    protection = DerBitString.GetInstance(tObj, true);
                }
                else
                {
                    extraCerts = Asn1Sequence.GetInstance(tObj, true);
                }
            }
        }
Пример #10
0
        public override Asn1Object ToAsn1Object()
        {
            Asn1EncodableVector v = new Asn1EncodableVector(new Asn1Encodable[]
            {
                this.pvno,
                this.sender,
                this.recipient
            });

            PkiHeader.AddOptional(v, 0, this.messageTime);
            PkiHeader.AddOptional(v, 1, this.protectionAlg);
            PkiHeader.AddOptional(v, 2, this.senderKID);
            PkiHeader.AddOptional(v, 3, this.recipKID);
            PkiHeader.AddOptional(v, 4, this.transactionID);
            PkiHeader.AddOptional(v, 5, this.senderNonce);
            PkiHeader.AddOptional(v, 6, this.recipNonce);
            PkiHeader.AddOptional(v, 7, this.freeText);
            PkiHeader.AddOptional(v, 8, this.generalInfo);
            return(new DerSequence(v));
        }
Пример #11
0
 public PkiMessage(
     PkiHeader header,
     PkiBody body)
     : this(header, body, null, null)
 {
 }
Пример #12
0
 public ProtectedPart(PkiHeader header, PkiBody body)
 {
     this.header = header;
     this.body   = body;
 }
Пример #13
0
 private ProtectedPart(Asn1Sequence seq)
 {
     header = PkiHeader.GetInstance(seq[0]);
     body   = PkiBody.GetInstance(seq[1]);
 }
Пример #14
0
		public ProtectedPart(PkiHeader header, PkiBody body)
		{
			this.header = header;
			this.body = body;
		}
Пример #15
0
		private ProtectedPart(Asn1Sequence seq)
		{
			header = PkiHeader.GetInstance(seq[0]);
			body = PkiBody.GetInstance(seq[1]);
		}
Пример #16
0
 public PkiMessage(
     PkiHeader header,
     PkiBody body)
     : this(header, body, null, null)
 {
 }