Beispiel #1
0
        public static void InstallServantCertificate()
        {
            var store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
            store.Open(OpenFlags.ReadWrite);

            //CRASH!
                // Servant certifikatet kan ikke bindes til Azure serveren, ved mindre det bliver eksporteret og importeret først. Den siger det der med local user blablal..

            X509Certificate2 cert;
            using (var ctx = new CryptContext())
            {
                ctx.Open();
                cert = ctx.CreateSelfSignedCertificate(
                    new SelfSignedCertProperties
                    {
                        IsPrivateKeyExportable = true,
                        KeyBitLength = 4096,
                        Name = new X500DistinguishedName("CN=\"Servant\"; C=\"Denmark\"; O=\"Denmark\"; OU=\"Denmark\";"),
                        ValidFrom = DateTime.Today,
                        ValidTo = DateTime.Today.AddYears(10)
                    });
            }
            cert.FriendlyName = "Servant";
            store.Add(cert);
            store.Close();

            System.Threading.Thread.Sleep(1000); // Wait for certificate to be installed
        }
 internal SignatureKey(CryptContext ctx, IntPtr handle) : base(ctx, handle) { }
Beispiel #3
0
 internal KeyExchangeKey(CryptContext ctx, IntPtr handle) : base(ctx, handle)
 {
 }
Beispiel #4
0
 internal CryptKey(CryptContext ctx, IntPtr handle)
 {
     this.ctx    = ctx;
     this.handle = handle;
 }
 internal CryptKey(CryptContext ctx, IntPtr handle)
 {
     this.ctx = ctx;
     this.handle = handle;
 }
 internal KeyExchangeKey(CryptContext ctx, IntPtr handle) : base(ctx, handle)  {}
 internal SignatureKey(CryptContext ctx, IntPtr handle) : base(ctx, handle)
 {
 }