title: How to convert ECDiffieHellman instance to DER file in .net framework?
body: <p>I have following code:</p>
  
  <pre><code>        var p = new ECParameters();
          p.Curve = System.Security.Cryptography.ECCurve.NamedCurves.nistP256;
          p.D = Utility.HexToBytes("FF46D661B3505B4BE84CF2FEB0A34B17FE0AA690FACBC0BBC6D6D526A14CE677");
          var point2 = new System.Security.Cryptography.ECPoint();
          point2.X = Utility.HexToBytes("8D11BB84CC509F6AA27314926C818522A8441E64251B0F6EAAF76947378C2A7A");
          point2.Y = Utility.HexToBytes("45FA696E17A3A172F83CB57F617E810A6E1AF686B9CED06E8E51C587CD83900D");
          p.Q = point2;
          p.Validate();
  
          var ecdh = ECDiffieHellman.Create(p);
  </code></pre>
  
  <p>How can I export the 'ecdh' into DER encoded file with or without using Bouncy castle.net library?</p>