phpecc | Pure PHP Elliptic Curve Cryptography Library | Cryptography library
kandi X-RAY | phpecc Summary
kandi X-RAY | phpecc Summary
Pure PHP Elliptic Curve Cryptography Library
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Calculates the square root modulo of this matrix .
- Gets a crypto point by its name .
- Call a function .
- Get the point for this curve .
- Recover the Y coordinate from a x coordinate .
- Verify a public key .
- Checks if a point is valid
- Check the state of the exchange .
- Convert negative integer to hex
- Returns a substring .
phpecc Key Features
phpecc Examples and Code Snippets
Community Discussions
Trending Discussions on phpecc
QUESTION
I'm trying to generate a shared secret between a web server running PHP and a C# desktop application. I'm aware of the BouncyCastle library, but I'd prefer not having to use it since it's pretty huge.
I'm using phpecc and ECDiffieHellmanCng and trying to generate a shared secret between the two parties but I'm having issues with exporting/importing in C#.
It seems phpecc requires der/pem format in order to import a key, and ECDiffieHellmanCng doesn't seem to have any easy way to export in a compatible format.
Would I need to write my own pem/der encoder and decoder in order to do this or is there some alternative easier way?
Currently I'm doing the following in C#:
...ANSWER
Answered 2017-May-10 at 15:52.NET Core 1.0 and .NET Framework 4.7 have the ECParameters struct to import/export keys. The ToByteArray()
method you called is producing a CNG EccPublicBlob which has very little to do with the SEC-1 ECParameters format.
I'm going to assume that you wanted to use secp384r1/NIST P-384, even though you specified that as a hash algorithm. If you want some other curve, you'll need to do some translations.
The (.NET) ECParameters struct will only help you get started. Turning that into a file requires translating it into a PEM-encoded DER-encoded ASN.1-based structure. (But if you're sticking with NIST P-256/384/521, you can do it with the byte[] you currently have)
In SEC 1 v2.0 we get the following structures:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install phpecc
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page