{"id":"9cf446862fbde168","repo":"spring-projects/spring-boot","slug":"error-decrypting-private-key","errorCode":null,"errorMessage":"Error decrypting private key","messagePattern":"Error decrypting private key","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ssl/PemPrivateKeyParser.java","lineNumber":464,"sourceCode":"\t */\n\tstatic class Pkcs8PrivateKeyDecryptor {\n\n\t\tpublic static final String PBES2_ALGORITHM = \"PBES2\";\n\n\t\tstatic PKCS8EncodedKeySpec decrypt(byte[] bytes, @Nullable String password) {\n\t\t\tAssert.state(password != null, \"Password is required for an encrypted private key\");\n\t\t\ttry {\n\t\t\t\tEncryptedPrivateKeyInfo keyInfo = new EncryptedPrivateKeyInfo(bytes);\n\t\t\t\tAlgorithmParameters algorithmParameters = keyInfo.getAlgParameters();\n\t\t\t\tString encryptionAlgorithm = getEncryptionAlgorithm(algorithmParameters, keyInfo.getAlgName());\n\t\t\t\tSecretKeyFactory keyFactory = SecretKeyFactory.getInstance(encryptionAlgorithm);\n\t\t\t\tSecretKey key = keyFactory.generateSecret(new PBEKeySpec(password.toCharArray()));\n\t\t\t\tCipher cipher = Cipher.getInstance(encryptionAlgorithm);\n\t\t\t\tcipher.init(Cipher.DECRYPT_MODE, key, algorithmParameters);\n\t\t\t\treturn keyInfo.getKeySpec(cipher);\n\t\t\t}\n\t\t\tcatch (IOException | GeneralSecurityException ex) {\n\t\t\t\tthrow new IllegalArgumentException(\"Error decrypting private key\", ex);\n\t\t\t}\n\t\t}\n\n\t\tprivate static String getEncryptionAlgorithm(@Nullable AlgorithmParameters algParameters, String algName) {\n\t\t\tif (algParameters != null && PBES2_ALGORITHM.equals(algName)) {\n\t\t\t\treturn algParameters.toString();\n\t\t\t}\n\t\t\treturn algName;\n\t\t}\n\n\t}\n\n\t/**\n\t * ANS.1 encoded object identifier.\n\t */\n\tstatic final class EncodedOid {\n\n\t\tstatic final EncodedOid OID_1_2_840_10040_4_1 = EncodedOid.of(\"2a8648ce380401\");","sourceCodeStart":446,"sourceCodeEnd":482,"githubUrl":"https://github.com/spring-projects/spring-boot/blob/5b2dbdbb8be64415eb6552f81ff7c449c8d251e6/buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ssl/PemPrivateKeyParser.java#L446-L482","documentation":"Error \"Error decrypting private key\" thrown in spring-projects/spring-boot.","triggerScenarios":"Thrown at buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ssl/PemPrivateKeyParser.java:464 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"5b2dbdbb8be64415eb6552f81ff7c449c8d251e6","analyzedAt":"2026-08-04T18:53:14.967Z","schemaVersion":2}