Class EphermalKey
A short term key on a curve.
Inherited Members
Namespace: PeerTalk.Cryptography
Assembly: PeerTalk.dll
Syntax
public class EphermalKey
Remarks
Ephemeral keys are different from other keys in IPFS; they are NOT protobuf encoded and are NOT self describing. The encoding is an uncompressed ECPoint; the first byte s a 4 and followed by X and Y co-ordinates.
It as assummed that the curve name is known a priori.
Methods
| Improve this Doc View SourceCreatePublicKeyFromIpfs(String, Byte[])
Create a public key from the IPFS ephermal encoding.
Declaration
public static EphermalKey CreatePublicKeyFromIpfs(string curveName, byte[] bytes)
Parameters
Type | Name | Description |
---|---|---|
String | curveName | The name of the curve, for example "P-256". |
Byte[] | bytes | The IPFS encoded ephermal key. |
Returns
Type | Description |
---|---|
EphermalKey |
Generate(String)
Create a new ephermal key on the curve.
Declaration
public static EphermalKey Generate(string curveName)
Parameters
Type | Name | Description |
---|---|---|
String | curveName | The name of the curve, for example "P-256". |
Returns
Type | Description |
---|---|
EphermalKey | The new created emphermal key. |
GenerateSharedSecret(EphermalKey)
Create a shared secret between this key and another.
Declaration
public byte[] GenerateSharedSecret(EphermalKey other)
Parameters
Type | Name | Description |
---|---|---|
EphermalKey | other | Another ephermal key. |
Returns
Type | Description |
---|---|
Byte[] | The shared secret as a byte array. |
Remarks
Uses the ECDH agreement algorithm to generate the shared secet.
PublicKeyBytes()
Gets the IPFS encoding of the public key.
Declaration
public byte[] PublicKeyBytes()
Returns
Type | Description |
---|---|
Byte[] | Returns the uncompressed EC point. |