Exemplo n.º 1
0
 public static extern IntPtr CertCreateSelfSignCertificate(
     [In, Optional]  IntPtr phProv,
     [In]                    Wincrypt.CRYPTOAPI_BLOB pSubjectIssuerBlob,
     [In]                    UInt32 flags,
     [In, Optional]  Wincrypt.CRYPT_KEY_PROV_INFO pKeyProvInfo,
     [In, Optional]  IntPtr pSignatureAlgorithm,
     [In, Optional]  Wincrypt.SystemTime pStartTime,
     [In, Optional]  Wincrypt.SystemTime pEndTime,
     [Optional]              Wincrypt.CERT_EXTENSIONS pExtensions
     );
Exemplo n.º 2
0
 void get_extensions()
 {
     if (CTLInfo.cExtension > 0)
     {
         Wincrypt.CERT_EXTENSIONS extstruct = new Wincrypt.CERT_EXTENSIONS {
             rgExtension = CTLInfo.rgExtension,
             cExtension  = CTLInfo.cExtension
         };
         _listExtensions.AddRange(CryptographyUtils.DecodeX509ExtensionCollection2(extstruct));
     }
 }
Exemplo n.º 3
0
        static List <X509Extension> decode_extstruct(Wincrypt.CERT_EXTENSIONS extstruct)
        {
            List <X509Extension> extensions = new List <X509Extension>();

            if (extstruct.cExtension > 0)
            {
                IntPtr rgExtension = extstruct.rgExtension;
                for (UInt32 index = 0; index < extstruct.cExtension; index++)
                {
                    Wincrypt.CERT_EXTENSION ExtEntry = (Wincrypt.CERT_EXTENSION)Marshal.PtrToStructure(rgExtension, typeof(Wincrypt.CERT_EXTENSION));
                    Byte[] rawData = new Byte[ExtEntry.Value.cbData];
                    Marshal.Copy(ExtEntry.Value.pbData, rawData, 0, rawData.Length);
                    extensions.Add(ConvertExtension(new X509Extension(ExtEntry.pszObjId, rawData, ExtEntry.fCritical)));
                    rgExtension = rgExtension + Marshal.SizeOf(typeof(Wincrypt.CERT_EXTENSION));
                }
            }
            return(extensions);
        }
Exemplo n.º 4
0
 internal static IEnumerable <X509Extension> DecodeX509ExtensionCollection2(Wincrypt.CERT_EXTENSIONS extstruct)
 {
     return(decode_extstruct(extstruct).ToArray());
 }