Code example for PKCS8EncodedKeySpec

            System.arraycopy(encSplit, 0, aesRaw, 0, aesRaw.length);
            encRaw = new byte[encSplit.length-RSA_BYTES];
            System.arraycopy(encSplit, RSA_BYTES, encRaw, 0, encRaw.length);
            // Decrypt encrypted aes data using RSAES-OAEP 
            PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(keyRaw);
            KeyFactory kf = KeyFactory.getInstance("RSA", "BC");
            Cipher c = Cipher.getInstance("RSA/None/OAEPWithSHA-1AndMGF1Padding");
            c.init(Cipher.DECRYPT_MODE, kf.generatePrivate(privateKeySpec));
            aesRaw = c.doFinal(aesRaw);
            // Decrypted enc using AES-CBC 
            byte[] aesKey = new byte[AES_BYTES];
            byte[] aesIv = new byte[aesRaw.length-aesKey.length];
            System.arraycopy(aesRaw, 0, aesKey, 0, aesKey.length);
            System.arraycopy(aesRaw, aesKey.length, aesIv, 0, aesIv.length);
            c = Cipher.getInstance("AES/CBC/PKCS7Padding");
            c.init(Cipher.DECRYPT_MODE, new SecretKeySpec(aesKey, "AES"), new IvParameterSpec(aesIv));
            byte[] dec = c.doFinal(encRaw);
Connect your IDE to all the code out there  Get Codota for Java