2

I am trying to create a shared secret using the ECDH-P-256 algorithm using the bouncy castle (c#) API. I need to use 2 static keys to generate this. These will then get hashed with some other (varying) data to produce a new key.

Does anyone know how to perform ECDH by using the C# API? I have been looking for a while and can only find code that uses Java.

Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263
gizmo
  • 85
  • 2
  • 7
  • BC API is rather similar for both C# and Java. Have you tried converting from a Java sample? Furthermore, the question is a bit unclear to me. Are you referring to ephemeral-static Diffie-Hellman, where one key pair is static? – Maarten Bodewes Sep 29 '14 at 07:02
  • In this case both keys are static. As I said the variation comes from hashing the resulting data with some other varying data. it looks like the c# lib has not been updated since 2011 so I am thinking this is a dead project. – gizmo Sep 29 '14 at 12:34
  • I would not call it dead, but I'm pretty certain that the focus is on FIPS validation and the Java code base. Asking for samples is off topic, I would just take a look at the `ECDHBasicAgreement` class and go from there. Make sure your ECDH implementation is according to 800-58A though and validate your public keys! – Maarten Bodewes Sep 29 '14 at 14:32

1 Answers1

1

I hope you have found something to proceed. For others landing here, please take a look at my answer here https://stackoverflow.com/a/31419559/190476 (to my own question). I've explained one variant of Key-derivation using ECDH and as per NIST SP 800-56A, section 5.8.1 together with the BouncyCastle C# API

Community
  • 1
  • 1
Sudhanshu Mishra
  • 6,523
  • 2
  • 59
  • 76