public (byte[] PublicKey, byte[] PrivateKey) GenerateKeys() { if (OperatingSystem.IsWindows()) { using (ECDiffieHellmanCng ECD = new ECDiffieHellmanCng(KeySize)) { var x = ECD.ExportParameters(true); ECD.KeyDerivationFunction = ECDHKDF; ECD.HashAlgorithm = HashingAlgorithm; return( ECD.PublicKey.ToByteArray(), ECD.ExportECPrivateKey() ); } } else { throw new NotSupportedException(); } }