0

I have following 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);

How can I export the 'ecdh' into DER encoded file with or without using Bouncy castle.net library?

Raghu
  • 2,859
  • 4
  • 33
  • 65
  • How does this question differ from [your other question?](https://stackoverflow.com/q/48507687/238704) – President James K. Polk Jan 31 '18 at 13:57
  • The other one uses a brand new ecdh object where as here I am constructing ecdh instance from known values. Also the other one is dealing with only public portion, this one does not. Hope that helps. – Raghu Jan 31 '18 at 14:05
  • When you talk about DER encoding you should have in mind the relevant ASN.1 structure that's being encoded. Objects of classes aren't specified in ASN.1, so there's no DER encoding for them. What you want sounds more like object serialization. – President James K. Polk Jan 31 '18 at 14:49
  • What I want is how to represent a given temporary ECC public and private key pair (for ECDH) in DER encoding format. I do not want object serialization. The other post showed how to represent temporary ECC public key in DER encoding format. I am simply asking for the same but this time with private key thrown in there. Please let me know if I am asking the question in a wrong way. – Raghu Jan 31 '18 at 19:57

0 Answers0