• Creating a Signature Object

    Parameters

    • hash: Hashs

      Indicates the hash algorithm name. Note: MD5 and SHA1 are insecure hash algorithms.

    • Optional saltLength: SaltLength

    Returns "crypto".Signer

    Example


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

    let rsakey = crypto.generateKey(1024);

    let data = buffer.from("huawei");
    let sign = crypto.createSign(crypto.Hashs.SHA256);
    let signed = sign.sign(rsakey.privateKey, data);

    console.log(signed.toString(buffer.Encoding.Base64));