Class: Toybox.Cryptography.KeyPair

Overview

A public and private key pair.

See Also:

Since:

API Level 3.0.0

Supported Devices:

Instance Method Summary collapse

Instance Method Details

getPrivateKey() as Cryptography.Key

Get the private key.

Returns:

Since:

API Level 3.0.0

getPublicKey() as Cryptography.Key

Get the public key.

Returns:

Since:

API Level 3.0.0

initialize(options as { :algorithm as Cryptography.KeyPairAlgorithm, :privateKey as Lang.ByteArray })

Constructor

A KeyPair can be initialized from a private key by passing a private key ByteArray from an initialized Key object into the :privateKey option of the initialize method for this class. If no private key is provided, then both a private and public key will be generated using the required :algorithm option.

Note:

privateKey is expected to be in little-endian byte order.

Parameters:

  • options(Lang.Dictionary)

    A dictionary of options

    • :algorithm(Lang.Number)

      The hash algorithm to use as a KEY_PAIR_* constant (required)

    • :privateKey(Lang.ByteArray)

      The private key to be used to generate the KeyPair (optional)

Since:

API Level 3.0.0

Throws:


Generated Apr 17, 2024 9:40:37 AM