id: ecdh title: ECDH sidebar_label: ECDH

ECDH

Kind: global class
this: {“{”}ECDH{"}"}

new ECDH()

Creates an instance of ECDH

ECDH.inttobytes() ⇒

Convert Integer to n-byte array

Kind: static method of ECDH
Returns: byte array
this: {“{”}ECDH{"}"}
Parameter: n integer
Parameter: len integer length

ECDH.bytestostring() ⇒

Convert byte array to string

Kind: static method of ECDH
Returns: string
this: {“{”}ECDH{"}"}
Parameter: b byte array

ECDH.stringtobytes() ⇒

Convert string to byte array

Kind: static method of ECDH
Returns: byte array
this: {“{”}ECDH{"}"}
Parameter: s string

ECDH.hashit() ⇒

general purpose hash function w=hash(B|n)

Kind: static method of ECDH
Returns: w output
this: {“{”}ECDH{"}"}
Parameter: sha is the hash type
Parameter: A byte array involved in the hash
Parameter: n integer involved in the hash
Parameter: pad padding

ECDH.KDF2() ⇒

IEEE-1363 Key Derivation Function - generates key K from inputs Z and P

Kind: static method of ECDH
Returns: K derived key
this: {“{”}ECDH{"}"}
Parameter: sha is the hash type
Parameter: Z input byte array
Parameter: P input key derivation parameters - can be NULL
Parameter: 0len is output desired length of key

ECDH.PBKDF2() ⇒

Password Based Key Derivation Function - generates key K from password, salt and repeat counter

Kind: static method of ECDH
Returns: key derived key
this: {“{”}ECDH{"}"}
Parameter: sha is the hash type
Parameter: Pass input password
Parameter: Salt salt value
Parameter: rep Number of times to be iterated.
Parameter: 0len is output desired length of key

ECDH.HMAC() ⇒

HMAC of message M using key K to create tag of length tag.length

Kind: static method of ECDH
Returns: error code
this: {“{”}ECDH{"}"}
Parameter: sha is the hash type
Parameter: M input message
Parameter: K input encryption key
Parameter: tag is the output HMAC

ECDH.AES_CBC_IV0_ENCRYPT() ⇒

AES encrypts a plaintext to a ciphtertext

Kind: static method of ECDH
Returns: C Ciphertext
this: {“{”}ECDH{"}"}
Parameter: M input message
Parameter: K AES key

ECDH.AES_CBC_IV0_DECRYPT() ⇒

AES encrypts a plaintext to a ciphtertext

Kind: static method of ECDH
Returns: P Plaintext
this: {“{”}ECDH{"}"}
Parameter: C Ciphertext
Parameter: K AES key

ECDH.KEY_PAIR_GENERATE() ⇒

Generate an ECC public/private key pair

Kind: static method of ECDH
Returns: 0 or an error code
this: {“{”}ECDH{"}"}
Parameter: rng Cryptographically Secure Random Number Generator
Parameter: S the private key
Parameter: W the output public key, which is s.G, where G is a fixed generator

ECDH.PUBLIC_KEY_VALIDATE() ⇒

Generate an ECC public/private key pair

Kind: static method of ECDH
Returns: 0 or an error code
this: {“{”}ECDH{"}"}
Parameter: W the input public key to be validated

ECDH.ECPSVDP_DH() ⇒

Generate Diffie-Hellman shared key

Kind: static method of ECDH
Returns: 0 or an error code
this: {“{”}ECDH{"}"}
Parameter: S the private key
Parameter: W the output public key, which is s.G, where G is a fixed generator
Parameter: K the output shared key, in fact the x-coordinate of s.W

ECDH.ECPSP_DSA() ⇒

ECDSA Signature

Kind: static method of ECDH
Returns: 0 or an error code
this: {“{”}ECDH{"}"}
Parameter: sha is the hash type
Parameter: RNG Cryptographically Secure Random Number Generator
Parameter: S the private key
Parameter: F the input message to be signed
Parameter: C component of the output signature
Parameter: D component of the output signature

ECDH.ECPVP_DSA() ⇒

ECDSA Signature Verification

Kind: static method of ECDH
Returns: 0 or an error code
this: {“{”}ECDH{"}"}
Parameter: sha is the hash type
Parameter: W the public key
Parameter: F the input message to be signed
Parameter: C component of the output signature
Parameter: D component of the output signature

ECDH.ECIES_ENCRYPT() ⇒

ECIES Encryption

Kind: static method of ECDH
Returns: C ciphertext
this: {“{”}ECDH{"}"}
Parameter: sha is the hash type
Parameter: P1 input Key Derivation parameters
Parameter: P2 input Encoding parameters
Parameter: RNG Cryptographically Secure Random Number Generator
Parameter: W the public key
Parameter: M the input message to be encrypted
Parameter: V component of the output ciphertext
Parameter: T the output HMAC tag, part of the ciphertext

ECDH.ECIES_DECRYPT() ⇒

ECIES Encryption

Kind: static method of ECDH
Returns: M plaintext
this: {“{”}ECDH{"}"}
Parameter: sha is the hash type
Parameter: P1 input Key Derivation parameters
Parameter: P2 input Encoding parameters
Parameter: V component of the output ciphertext
Parameter: C Ciphertext
Parameter: T the output HMAC tag, part of the ciphertext
Parameter: U the private key