RsaSha256

types~ RsaSha256

RSA-SHA-256: RSA signature condition using SHA-256.

This RSA condition uses RSA-PSS padding with SHA-256. The salt length is set equal the digest length of 32 bytes.

The public exponent is fixed at 65537 and the public modulus must be between 128 (1017 bits) and 512 bytes (4096 bits) long.

RSA-SHA-256 is assigned the type ID 3. It relies on the SHA-256 and RSA-PSS feature suites which corresponds to a feature bitmask of 0x11.

Constructor

new RsaSha256()

Source:

Methods

setPublicModulus(modulus)

Set the public modulus.

This is the modulus of the RSA public key. It has to be provided as a raw buffer with no leading zeros.

Parameters:
Name Type Description
modulus Buffer

Public RSA modulus

Source:

setSignature(signature)

Set the signature manually.

The signature must be a valid RSA-PSS siganture.

Parameters:
Name Type Description
signature Buffer

RSA signature.

Source:

sign(message, privateKey)

Sign the message.

This method will take the provided message and create a signature using the provided RSA private key. The resulting signature is stored in the fulfillment.

The key should be provided as a PEM encoded private key string.

The message is padded using RSA-PSS with SHA256.

Parameters:
Name Type Description
message Buffer

Message to sign.

privateKey String

RSA private key

Source:

validate(message) → {Boolean}

Verify the signature of this RSA fulfillment.

The signature of this RSA fulfillment is verified against the provided message and the condition's public modulus.

Parameters:
Name Type Description
message Buffer

Message to verify.

Source:
Returns:

Whether this fulfillment is valid.

Type
Boolean