Exemple #1
0
        public void DecodeX509BasicConstraints2Extension(byte[] encoded, out bool certificateAuthority, out bool hasPathLengthConstraint, out int pathLengthConstraint)
        {
            unsafe
            {
                bool localCertificateAuthority    = false;
                bool localHasPathLengthConstraint = false;
                int  localPathLengthConstraint    = 0;

                encoded.DecodeObject(
                    CryptDecodeObjectStructType.X509_BASIC_CONSTRAINTS2,
                    delegate(void *pvDecoded, int cbDecoded)
                {
                    Debug.Assert(cbDecoded >= sizeof(CERT_BASIC_CONSTRAINTS2_INFO));
                    CERT_BASIC_CONSTRAINTS2_INFO *pBasicConstraints2 = (CERT_BASIC_CONSTRAINTS2_INFO *)pvDecoded;
                    localCertificateAuthority    = pBasicConstraints2->fCA != 0;
                    localHasPathLengthConstraint = pBasicConstraints2->fPathLenConstraint != 0;
                    localPathLengthConstraint    = pBasicConstraints2->dwPathLenConstraint;
                }
                    );

                certificateAuthority    = localCertificateAuthority;
                hasPathLengthConstraint = localHasPathLengthConstraint;
                pathLengthConstraint    = localPathLengthConstraint;
            }
        }
 public void DecodeX509BasicConstraints2Extension(byte[] encoded, out bool certificateAuthority, out bool hasPathLengthConstraint, out int pathLengthConstraint)
 {
     unsafe
     {
         (certificateAuthority, hasPathLengthConstraint, pathLengthConstraint) = encoded.DecodeObject(
             CryptDecodeObjectStructType.X509_BASIC_CONSTRAINTS2,
             static delegate(void *pvDecoded, int cbDecoded)
         {
             Debug.Assert(cbDecoded >= sizeof(CERT_BASIC_CONSTRAINTS2_INFO));
             CERT_BASIC_CONSTRAINTS2_INFO *pBasicConstraints2 = (CERT_BASIC_CONSTRAINTS2_INFO *)pvDecoded;
             return(pBasicConstraints2->fCA != 0,
                    pBasicConstraints2->fPathLenConstraint != 0,
                    pBasicConstraints2->dwPathLenConstraint);
         });
     }
 }