How to create a strong password?

There are a few things you can do to create a strong password that will protect your account from being compromised. Use lower case, upper case, numbers, and symbols (check list of valid symbols, this could vary depending on the website / system) Use at least 12 chars to allow a wide key space Don’t use common words or easy-to-guess …

How to generate RSA public and private keys with OpenSSL

Before anything, I assume that you already have OpenSSL installed in your PC. In case you don’t and you are a Windows you can download it from this URLs: http://slproweb.com/products/Win32OpenSSL.html http://gnuwin32.sourceforge.net/packages/openssl.htm I personally used the first one. After you are done with the installation follow this steps: Open a command line window and run the following command: openssl genrsa -out …

Elliptic Curve Diffie-Hellman and AES Example in Node.JS

Recently I learned how to generate shared secrets using ECDH in Node.JS, but I still had to know how to use this shared secret. Here is one application for it. Use the ECDH to generate a shared secret and then use that shared secret to cipher/decipher messages between both parties, in this case Joe and Zoe. Here is the code: …

How to generate Diffie Hellman key pair in Node.JS

Super easy using crypto library. You can create a file called¬†DiffieHellmanKeyPairGeneration.js for example and paste this code inside: console.log(‘\n- — ( Diffie Hellman Key Pair Generator ) — -‘); var crypto = require(‘crypto’); var bitSize = 2048; var dh = crypto.createDiffieHellman(bitSize); dh.generateKeys(); console.log(‘Private Key:\n’ + dh.getPrivateKey(‘base64’)); console.log(‘\n’); console.log(‘Public Key:\n’ + dh.getPublicKey(‘base64’)); console.log(‘— End —‘); Then run it, wait…wait…wait…wait…wait…wait…, and you …

How to Encrypt / Decrypt with AES in Node.JS

Easy as pie! var crypto = require(‘crypto’); var AES128 = “aes128”; var AES192 = “aes192”; var AES256 = “aes256”; var password = ‘Austin’; var plainText = ‘Texas to the bone!’; // ———————————————— var cipher = crypto.createCipher(AES128, password); var decipher = crypto.createDecipher(AES128, password); console.log(‘AES-128:’); // Encrypting with AES128 var encText = cipher.update(plainText, ‘utf8’, ‘hex’); encText += cipher.final(‘hex’); console.log(encText); // Decrypting with …

How to Encrypt / Decrypt with AES in Java 1.8

Here I have created a class that does it in two different ways, the first one is, when you create the key, and the other is when you are given the key, valid key sizes are 128, 192, and 256 for AES algorithm. There is some steps to follow before executing the code provied, if you don’t probably this class …

How to generate X.509 certificate in Java 1.8

Here is how to do it, the simplest way, to generate the base64 string. No complications with KeyStores or things like that. I must say that I found this code in several places over the Internet. When I tried to run it I had some exceptions, I solved them, at the time of this writing, the following code works with …

How to scan Java files only in HP Fortify Audit Workbench 16.10

Recently I needed to run a Fortify scan on a project with several modules. I was told to scan only Java files (*.java) but with the constraint that this files should not be the ones inside test directories (*test*) After doing some research and reading the documentation I came up with the following command: “-b” “SiryProject” “-machine-output” “-source” “1.8” “C:MyProjectsSiryProject**srcmainjava***.java” …