Hierarchy

  • Cryptography

Methods

  • Description

    Envelopes data using an RSA public key.

    Returns

    Returns the enveloped data.

    Throws

    HsmError If the data cannot be enveloped or an error occurs in the operation.

    Parameters

    • pubKey: Buffer

      RSA public key that will be used to envelop the data.

    • keyLength: RSA_LENGTH_KEYS
    • date: Buffer

      Given that it will be enveloped.

    • paddingOption: ENC_DEC_PADDING

      Filling option used in data encryption.

    Returns Promise<Buffer>

  • Description

    Unwrap data using an RSA key.

    Returns

    Returns the de-enveloped data.

    Throws

    HsmError If it is not possible to de-envelope the data or if there is an error in the operation.

    Parameters

    • keyName: string

      Name of the RSA private key.

    • date: Buffer

      Given that it will be de-enveloped.

    • paddingOption: ENC_DEC_PADDING

      Filling option used in data encryption.

    Returns Promise<Buffer>

  • Description

    Signs data using an ECC private key.

    Returns

    Returns a buffer with the data signature.

    Throws

    HsmError If it is not possible to sign the data or there is an error in the operation.

    Parameters

    • keyName: string

      Key name.

    • hashAlgorithm: HASH_ALGORITHMS

      Algorithm used to generate the hash of the data.

    • hash: Buffer

      Hash of the data to be signed.

    Returns Promise<Buffer>

  • Description

    Verifies a data signature using an ECC key.

    Returns

    Return true if the signature is valid and false otherwise.

    Throws

    HsmError If the signature cannot be verified or an error occurs in the operation.

    Parameters

    • keyName: string

      Key name.

    • hashAlgorithm: HASH_ALGORITHMS

      Algorithm used to generate the hash of the data.

    • hash: Buffer

      Hash of the data to be verified.

    • signature: Buffer

      Signature of the data to be verified.

    Returns Promise<boolean>

  • Description

    Signs data using an EdDSA private key.

    Returns

    Returns a buffer with the data signature.

    Throws

    HsmError If it is not possible to sign the data or there is an error in the operation.

    Parameters

    • keyName: string

      Key name.

    • hash: Buffer

      Hash of the data to be signed.

    Returns Promise<Buffer>

  • Description

    Verifies a data signature using an EdDSA key.

    Returns

    Return true if the signature is valid and false otherwise.

    Throws

    HsmError If the signature cannot be verified or an error occurs in the operation.

    Parameters

    • keyName: string

      Key name.

    • hash: Buffer

      Hash of the data to be verified.

    • signature: Buffer

      Signature of the data to be verified.

    Returns Promise<boolean>

  • Description

    Reconstructs the secret M of N from the parts of the custodians. According to Shamir's secret-sharing pattern.

    Returns

    Returns a buffer with the reconstructed secret.

    Throws

    HsmError If it is not possible to reconstruct the secret or an error occurs in the operation.

    Parameters

    • parts: Buffer[]

      Array of buffers with the parts of the secret generated by the mOfnSplit function.

    Returns Promise<Buffer>

  • Description

    Divides M from N in a secret. According to Shamir's secret sharing pattern.

    Returns

    Returns a buffer with the secret split.

    Throws

    HsmError If it is not possible to split the secret or an error occurs in the operation.

    Parameters

    • m: number

      Minimum number of parts needed to reconstruct the secret. Minimum M_OF_N_SECRET_MIN_N and maximum must be less than or equal to n.

    • n: number

      Total number of parts generated. Minimum of M_OF_N_SECRET_MIN_N and maximum of M_OF_N_SECRET_MAX_N.

    • Optional secret: null | string

      Secret that will be shared in several parts. It should be M_OF_N_SECRET_LEN characters. Can be passed NULL so that a secret is randomly generated by the HSM, in which case the value will be returned in MofNSplit.

    Returns Promise<MofNSplit>

  • Description

    Signs data using an RSA private key.

    Returns

    Returns a buffer with the data signature.

    Throws

    HsmError If it is not possible to sign the data or there is an error in the operation.

    Parameters

    • keyName: string

      Key name.

    • hashAlgorithm: HASH_ALGORITHMS

      Algorithm used to generate the hash of the data.

    • hash: Buffer

      Hash of the data to be signed.

    • pad: PAD_TYPE

      Type of padding to be used in the signature.

    Returns Promise<Buffer>

  • Description

    Verifies a data signature using an RSA key.

    Returns

    Return true if the signature is valid and false otherwise.

    Throws

    HsmError If the signature cannot be verified or an error occurs in the operation.

    Parameters

    • keyName: string

      Key name.

    • hashAlgorithm: HASH_ALGORITHMS

      Algorithm used to generate the hash of the data.

    • pad: PAD_TYPE

      Type of padding to be used in the signature.

    • hash: Buffer

      Hash of the data to be verified.

    • signature: Buffer

      Signature of the data to be verified.

    Returns Promise<boolean>