Daily Archives: March 15, 2017

How to convert byte array to hex string in Java 1.8

If you like cryptography you might know that sometimes you have a byte array which you wish to convert to hexadecimal string. In java, to this day, I haven’t found yet a native class that does it, I’ve spent several minutes on the Internet looking for something like the Base64 class. Turns out Apache commons […]

How to generate RSA key pair in Java 1.8

Recently I was wondering how to generate a private key in Java for a personal project. I found out how to generate the actual key pair with RSA algorithm. Here is the java code for that, a simple class that you can run to check how things work. import java.security.KeyPairGenerator; import java.security.KeyPair; import java.security.PrivateKey; import […]