Security.addProvider(new BouncyCastleProvider());
// generate RSA keys
RSAKeyPairGenerator gen = new RSAKeyPairGenerator();
gen.init(new RSAKeyGenerationParameters(new BigInteger("10001", 16), new SecureRandom(), 2048, 80));
AsymmetricCipherKeyPair keyPair = gen.generateKeyPair();
// some data where first entry is 0
byte[] data = { 10, 122, 12, 127, 35, 58, 87, 56, -6, 73, 10, -13, -78, 4, -122, -61 };
// encrypt data asymmetrically