ACMESharp.AcmeUnitTests.TestEcdhKeys C# (CSharp) Метод

TestEcdhKeys() приватный Метод

private TestEcdhKeys ( ) : void
Результат void
        public void TestEcdhKeys()
        {
            // To make sure keys are exportable:
            //    http://stackoverflow.com/questions/20505325/how-to-export-private-key-for-ecdiffiehellmancng/20505976#20505976

            var ecdhKeyParams = new CngKeyCreationParameters
            {
                KeyUsage = CngKeyUsages.AllUsages,
                ExportPolicy = CngExportPolicies.AllowPlaintextExport
            };
            var ecdhKey = CngKey.Create(CngAlgorithm.ECDiffieHellmanP256, null, ecdhKeyParams);
            var ecdh = new ECDiffieHellmanCng(ecdhKey);
            ecdh.KeySize = 256;

            //Export the keys
            var privateKey = ecdh.Key.Export(CngKeyBlobFormat.EccPrivateBlob);

            // This returns:
            //   [ { MinSize = 256; MaxSize = 384; SkipSize = 128 }
            //     { MinSize = 521; MaxSize = 521; SkipSize = 0   } ]
            var keySizes = ecdh.LegalKeySizes;
            // Example of this:
            //      <ECDHKeyValue xmlns="http://www.w3.org/2001/04/xmldsig-more#">
            //        <DomainParameters>
            //          <NamedCurve URN="urn:oid:1.3.132.0.35" />
            //        </DomainParameters>
            //        <PublicKey>
            //          <X Value="6338036285454860977775086861655185721418051140960904673987863656163882965225521398319125216217757952736756437624751684728661860413862054254572205453827782795" xsi:type="PrimeFieldElemType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
            //          <Y Value="2429739115523607678822648112222739155064474393176967830414279652115290771735466025346855521196073509912224542851147234378090051353981358078708633637907317343" xsi:type="PrimeFieldElemType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
            //        </PublicKey>
            //      </ECDHKeyValue>
            var pubKeyXml = ecdh.PublicKey.ToXmlString();
        }