Exemplo n.º 1
0
        /// <summary>
        /// Encode the certificate fields in DER format.
        /// </summary>
        ///
        /// <returns>The DER encoded contents of the certificate.</returns>
        private net.named_data.jndn.encoding.der.DerNode.DerSequence  toDer()
        {
            net.named_data.jndn.encoding.der.DerNode.DerSequence        root      = new net.named_data.jndn.encoding.der.DerNode.DerSequence();
            net.named_data.jndn.encoding.der.DerNode.DerSequence        validity  = new net.named_data.jndn.encoding.der.DerNode.DerSequence();
            net.named_data.jndn.encoding.der.DerNode.DerGeneralizedTime notBefore = new net.named_data.jndn.encoding.der.DerNode.DerGeneralizedTime(getNotBefore());
            net.named_data.jndn.encoding.der.DerNode.DerGeneralizedTime notAfter  = new net.named_data.jndn.encoding.der.DerNode.DerGeneralizedTime(getNotAfter());

            validity.addChild(notBefore);
            validity.addChild(notAfter);

            root.addChild(validity);

            net.named_data.jndn.encoding.der.DerNode.DerSequence subjectList = new net.named_data.jndn.encoding.der.DerNode.DerSequence();
            for (int i = 0; i < subjectDescriptionList_.Count; ++i)
            {
                subjectList
                .addChild(((CertificateSubjectDescription)subjectDescriptionList_[i]).toDer());
            }

            root.addChild(subjectList);
            root.addChild(key_.toDer());

            if (extensionList_.Count > 0)
            {
                net.named_data.jndn.encoding.der.DerNode.DerSequence extensionList = new net.named_data.jndn.encoding.der.DerNode.DerSequence();
                for (int i_0 = 0; i_0 < extensionList_.Count; ++i_0)
                {
                    extensionList.addChild(((CertificateExtension)extensionList_[i_0]).toDer());
                }
                root.addChild(extensionList);
            }

            return(root);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Encode the certificate fields in DER format.
        /// </summary>
        ///
        /// <returns>The DER encoded contents of the certificate.</returns>
        private net.named_data.jndn.encoding.der.DerNode.DerSequence toDer()
        {
            net.named_data.jndn.encoding.der.DerNode.DerSequence  root = new net.named_data.jndn.encoding.der.DerNode.DerSequence ();
            net.named_data.jndn.encoding.der.DerNode.DerSequence  validity = new net.named_data.jndn.encoding.der.DerNode.DerSequence ();
            net.named_data.jndn.encoding.der.DerNode.DerGeneralizedTime  notBefore = new net.named_data.jndn.encoding.der.DerNode.DerGeneralizedTime (notBefore_);
            net.named_data.jndn.encoding.der.DerNode.DerGeneralizedTime  notAfter = new net.named_data.jndn.encoding.der.DerNode.DerGeneralizedTime (notAfter_);

            validity.addChild(notBefore);
            validity.addChild(notAfter);

            root.addChild(validity);

            net.named_data.jndn.encoding.der.DerNode.DerSequence  subjectList = new net.named_data.jndn.encoding.der.DerNode.DerSequence ();
            for (int i = 0; i < subjectDescriptionList_.Count; ++i)
                subjectList
                        .addChild(((CertificateSubjectDescription) subjectDescriptionList_[i]).toDer());

            root.addChild(subjectList);
            root.addChild(key_.toDer());

            if (extensionList_.Count > 0) {
                net.named_data.jndn.encoding.der.DerNode.DerSequence  extensionList = new net.named_data.jndn.encoding.der.DerNode.DerSequence ();
                for (int i_0 = 0; i_0 < extensionList_.Count; ++i_0)
                    extensionList.addChild(((CertificateExtension) extensionList_[i_0]).toDer());
                root.addChild(extensionList);
            }

            return root;
        }