Beispiel #1
0
        private void readRequest(bool verify)
        {
            // Perform POP on the request
            if ((verify) && (!Request.Verify()))
            {
                throw new SignatureException("Invalid signature on PKCS#10 request");
            }

            // Contents
            info = Request.GetCertificationRequestInfo();

            // Attributes - if there are no attributes in the request then info.Attributes will be null and cause an
            // exception in the following foreach; attributes should be null if there aren't any.
            if (info.Attributes != null)
            {
                attributes = new Dictionary <DerObjectIdentifier, Asn1Set>();
                foreach (object entry in info.Attributes)
                {
                    AttributePkcs attrib = AttributePkcs.GetInstance(entry);
                    attributes.Add(attrib.AttrType, attrib.AttrValues);
                }
            }
            else
            {
                attributes = null;
            }

            // Extensions in OSCA format
            // Make sure there are some extensions first
            if (Extensions != null)
            {
                foreach (DerObjectIdentifier oid in Extensions.ExtensionOids)
                {
                    oscaExtensions.Add(ProfileExtensionFactory.GetExtension(oid, Extensions.GetExtension(oid)));
                }
            }
        }
Beispiel #2
0
        private void readRequest()
        {
            // Perform POP on the request
            if (!request.Verify())
            {
                throw new SignatureException("Invalid signature on PKCS#10 request");
            }

            // Contents
            info = request.GetCertificationRequestInfo();

            // Extensions in OSCA format
            foreach (DerObjectIdentifier oid in Extensions.ExtensionOids)
            {
                oscaExtensions.Add(ProfileExtensionFactory.GetExtension(oid, Extensions.GetExtension(oid)));
            }

            // Attributes
            foreach (object entry in Attributes)
            {
                AttributePkcs attrib = AttributePkcs.GetInstance(entry);
                attributes.Add(attrib.AttrType, attrib.AttrValues);
            }
        }