Excepción al descifrar un archivo "der" generado con OpenSSL: la longitud de entrada debe ser múltiplo de 8 al descifrar con cifrado rellenado

primero genero un archivo de clave RSA privado con OpenSSL y luego lo convierto en un archivo "der" cifrado:

$ openssl pkcs8 -topk8 -inform PEM -outform DER -in private_key.pem -out private_key.der

Luego trato de descifrar este archivo de Java usando el siguiente código (en esta etapa ya leí el archivo en elbyte[] key matriz usando el código que se encuentra al final de esta publicación):

public static byte[] decryptPrivateKey(byte[] key) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException {
    PBEKeySpec passKeySpec = new PBEKeySpec("p".toCharArray()); //my password

    EncryptedPrivateKeyInfo encryptedKey = new EncryptedPrivateKeyInfo(key);
    System.out.println(encryptedKey.getAlgName());
    //PBEWithMD5AndDES
    System.out.println("key length: " + key.length);
    //key length: 677
    SecretKeyFactory keyFac = SecretKeyFactory.getInstance(encryptedKey.getAlgName());
    SecretKey passKey = keyFac.generateSecret(passKeySpec);

     // Create PBE Cipher
    Cipher pbeCipher = Cipher.getInstance(encryptedKey.getAlgName());
    // Initialize PBE Cipher with key and parameters
    pbeCipher.init(Cipher.DECRYPT_MODE, passKey, encryptedKey.getAlgParameters());

    // Decrypt the private key(throws the exception)
    return pbeCipher.doFinal(key);
}

Obtengo el siguiente seguimiento de pila en la declaración de retorno anterior:

Exception in thread "main" javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:750)
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:676)
    at com.sun.crypto.provider.PBECipherCore.doFinal(PBECipherCore.java:422)
    at com.sun.crypto.provider.PBEWithMD5AndDESCipher.engineDoFinal(PBEWithMD5AndDESCipher.java:316)
    at javax.crypto.Cipher.doFinal(Cipher.java:2087)
    at roland.test.crypto.Test.decryptPrivateKey(Test.java:96)
    at roland.test.crypto.Test.getPrivateKey(Test.java:74)
    at roland.test.crypto.Test.test(Test.java:58)
    at roland.test.crypto.Test.main(Test.java:30)

La clave se lee del archivo "der" como una matriz de bytes:

public static PrivateKey getPrivateKey() throws Exception {
    byte[] key = null;
    try(final InputStream resourceStream = getMyClass().getResourceAsStream("private_key.der")) { //$NON-NLS-1$\r
        key = ByteStreams.toByteArray(resourceStream);
    } catch (IOException e) {
        e.printStackTrace();
    }

    key = decryptPrivateKey(key);
}

Respuestas a la pregunta(1)

Su respuesta a la pregunta