Library

Module

Module type

Parameter

Class

Class type

sectionYPositions = computeSectionYPositions($el), 10)" x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)">

On This Page

Legend:

Library

Module

Module type

Parameter

Class

Class type

Library

Module

Module type

Parameter

Class

Class type

Signature of the modules implementing the Diffie-Hellman functions for RFC 7748.

A private key for this curve. Private keys are, generally speaking, natural numbers for scalar multiplication of curve points.

A public key for this curve. Public keys form a curve in 2D space and are uniquely identified by their x-coordinate (up to symmetry).

`val base : public_key`

The base point of the curve.

`val public_key_of_string : string -> public_key`

Create a public key from a given string. The key is assumed to be encoded in hexadecimal and must have a length of `2*key_size`

. The string is silently truncated (if too long) or padded (if too short). An exception is raised if the string contains characters that are not valid hexadecimal digits. The curves in RFC 7748 are specially crafted such that public keys received from untrusted sources can be used safely without validation.

Note that the creation includes a canonicalization step and thus, in general, `string_of_public_key (public_key_of_string s) <> s`

.

`val private_key_of_string : string -> private_key`

Create a private key from a given string. The key is assumed to be encoded in hexadecimal and must have a length of `2*key_size`

. The string is silently truncated (if too long) or padded (if too short). An exception is raised if the string contains characters that are not valid hexadecimal digits. The curves in RFC 7748 are specially crafted such that any random sequence of bytes of the correct length can be used to create a private key.

Note that the creation includes a canonicalization step and thus, in general, `string_of_private_key (private_key_of_string s) <> s`

.

`val string_of_public_key : public_key -> string`

Convert the public key to its hex-encoded string representation.

`val string_of_private_key : private_key -> string`

Convert the private key to its hex-encoded string representation.

`val scale : private_key -> public_key -> public_key`

`scale priv pub`

is the scalar multiplication of `pub`

by `priv`

.

`val public_key_of_private_key : private_key -> public_key`

`public_key_of_private_key priv`

is equal to `scale priv base`

On This Page