• Creating a Signature Object

    Parameters

    Returns Verify

    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);

    let verify = crypto.createVerify(crypto.Hashs.SHA256);
    console.log(verify.verify(rsakey.publicKey, signed, data)); // true