Symmetric Key DetailsIn this case we will display the details of symmetric key methods, such as for the block size, key size and IV. |
Outline
The code used is:
const crypto = require("crypto"); var tt="aes-128-cbc"; var args = process.argv; if (args.length>2) tt=args[2]; tt1=crypto.getCipherInfo(tt) t=JSON.parse(JSON.stringify(tt1)); console.log("Name:\t\t"+t.name.toUpperCase()); console.log("Mode:\t\t"+t.mode.toUpperCase()); if (t.blockSize==undefined) { console.log("This is a stream cipher"); } else if (t.blockSize==1) { console.log("Blocksize:\t"+t.blockSize+ " Byte"); } else { console.log("Blocksize:\t"+t.blockSize+ " Bytes"); console.log(" This is a block cipher"); } if (t.blockSize==undefined) { console.log("No IV"); } else { console.log("IV Length:\t"+t.ivLength+ " Bytes"); } console.log("Key Length:\t"+t.keyLength+ " Bytes");