IPWorks Encrypt 2020 JavaScript Edition

Questions / Feedback?

Decrypt Method

Decrypts the input data using the specified private key.

Syntax

async elgamal.decrypt(): Promise<void>

Remarks

This method decrypts the input data using the private key specified in the Key* properties. Alternatively, a certificate may be specified by setting Certificate

Input and Output Properties

The class will determine the source and destination of the input and output based on which properties are set.

The order in which the input properties are checked is as follows:

When a valid source is found the search stops. The order in which the output properties are checked is as follows:

Key Size and the Maximum Length of Data

RSA has an upper limit to the amount of data that can be encrypted or decrypted, also known as message length. This can typically be calculated as the size of the key minus the size of the RSA header and padding.

When not using OAEP, the following formula and table can be referenced. (RSA Key Bytes) - (Header Bytes) = Length of data, where Header Bytes is always 11.

RSA Key Length (bits)Length (bits)Length (bytes)
1024 936 117
2048 1960 245
3072 2984 373
4096 4008 501

When using OAEP, the following formula and table can be referenced. (RSA Key Bytes) - (2 * Hash Length Bytes) - 2 = Length of data. The table below assumes SHA-256 for the hash, so Hash Length Bytes is 32.

RSA Key Length (bits)Length (bits)Length (bytes)
1024 496 62
2048 1520 190
3072 2544 318
4096 3568 446

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Encrypt 2020 JavaScript Edition - Version 20.0 [Build 8262]