Java – How to generate a random 12 bytes?
In Java, we can use SecureRandom.nextBytes(byte[] bytes) to generate a user-specified number of random bytes. This SecureRandom is a cryptographically secure random number generator (RNG). 1. Random 12 bytes (96 bits) 1.1 Generates a random 12 bytes (96 bits) nonce. HelloCryptoApp.java package com.mkyong.crypto; import java.security.SecureRandom; public class HelloCryptoApp { public static void main(String[] args) { …