• Creating a Decryption Object

    Parameters

    • algorithm: Algorithm

      Specifies the algorithm. Note: aes-ecb is not a security algorithm but an encryption algorithm.

    • key: Buffer

      Key. Note: Do not write sensitive information in plaintext in the code.

    • option: "crypto".Option

      Decryption Options

    Returns Decipher

    Example


    import * as crypto from 'crypto';
    import * as buffer from 'buffer';

    let key = buffer.from("************");
    let nonce = buffer.from("***********");
    let cipherText = buffer.from('iSzDBqz**********Bw==', buffer.Encoding.Base64);

    let decipher = crypto.createDecipher(crypto.Algorithm.AES_GCM, key, { nonce: nonce });
    let plainText = decipher.decrypt(cipherText);
    console.log(plainText.toString()); //huawei