Rsa

types~ Rsa

RSA-PSS using Node crypto module.

This class combines Node's native crypto functionality with PSS padding implemented in this library.

Constructor

new Rsa()

Source:

Methods

getModulusBitLength(modulus) → {Number}

Get the length in bits of an RSA modulus.

Parameters:
Name Type Description
modulus Buffer

RSA modulus.

Source:
Returns:

Number of bits in RSA modulus.

Type
Number

sign(privateKey, message) → {Buffer}

Sign a message using RSA-PSS.

Parameters:
Name Type Description
privateKey String

PEM-encoded RSA private key.

message Buffer

Message to sign.

Source:
Returns:

RSA signature.

Type
Buffer

verify(modulus, message, signature) → {Boolean}

Verify a RSA-PSS signature.

Parameters:
Name Type Description
modulus Buffer

RSA public modulus.

message Buffer

Message the signature should correspond to.

signature Buffer

RSA signature.

Source:
Returns:

Whether the signature is valid or not.

Type
Boolean