Utility module for checking whether NIST P-256 (secp256r1) ECC keys can be compressed to only their X coordinate. This implementation implements the strategy described in https://tools.ietf.org/html/draft-jivsov-ecc-compact-05 and is based on a 1986 publication by Victor Miller in 'CRYPTO 85'. This method is believed to be unpatentable. See https://cr.yp.to/ecdh/patents.html for more details.
The implementation is done as a NIF linked against the system's libcrypto.compact_key() = coordinate()
coordinate() = <<_:256>>
point() = <<_:520>>
private_key() = #'ECPrivateKey'{}
public_key() = {#'ECPoint'{}, {namedCurve, '?secp256r1'}}
generate_key/0 | Generate a NIST p-256 key that is compliant with the compactness restrictions. |
is_compact/1 | Returns whether a given key is compliant with the compactness restrictions. |
recover_key/1 | Given the X coordinate of a public key from a compliant point on the curve, return the public key. |
generate_key() -> {ok, private_key(), compact_key()}
Generate a NIST p-256 key that is compliant with the compactness restrictions.
is_compact(PubKey::private_key() | public_key() | point()) -> {true, compact_key()} | false
Returns whether a given key is compliant with the compactness restrictions. In the case that the key is compliant, also return the bare X coordinate.
recover_key(X::compact_key()) -> public_key()
Given the X coordinate of a public key from a compliant point on the curve, return the public key.
Generated by EDoc