コード例 #1
0
        public static byte[] CreateX509Certificate(string name, string password, DateTime validTo)
        {
            X509Certificate2         tempCert = null;
            SelfSignedCertProperties props    = new SelfSignedCertProperties
            {
                IsPrivateKeyExportable = true,
                KeyBitLength           = 1024,
                Name      = new X500DistinguishedName("CN=" + name),
                ValidFrom = DateTime.Now,
                ValidTo   = validTo
            };

            using (CryptContext ctx = new CryptContext())
            {
                ctx.Open();
                tempCert = ctx.CreateSelfSignedCertificate(props);
            }
            return(tempCert.Export(X509ContentType.Pfx, password));
        }
コード例 #2
0
 internal CryptKey(CryptContext ctx, IntPtr handle)
 {
     this.ctx    = ctx;
     this.handle = handle;
 }
コード例 #3
0
 internal KeyExchangeKey(CryptContext ctx, IntPtr handle)
     : base(ctx, handle)
 {
 }