Ejemplo n.º 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)));
        }
Ejemplo n.º 2
0
 public ProtectedPart(PkiHeader header, PkiBody body)
 {
     this.header = header;
     this.body   = body;
 }
Ejemplo n.º 3
0
 private ProtectedPart(Asn1Sequence seq)
 {
     header = PkiHeader.GetInstance(seq[0]);
     body   = PkiBody.GetInstance(seq[1]);
 }