Home / Function/ decrypt() — spring-boot Function Reference

decrypt() — spring-boot Function Reference

Architecture documentation for the decrypt() function in PemPrivateKeyParser.java from the spring-boot codebase.

Entity Profile

Dependency Diagram

graph TD
  a0127225_26e4_f097_c809_1f5f80482a5f["decrypt()"]
  fc4d177f_2930_7359_bdcb_d396623d69cf["createKeySpecForPkcs8Encrypted()"]
  fc4d177f_2930_7359_bdcb_d396623d69cf -->|calls| a0127225_26e4_f097_c809_1f5f80482a5f
  ad9fd036_4003_1938_502d_6e15c37d2c31["getEncryptionAlgorithm()"]
  a0127225_26e4_f097_c809_1f5f80482a5f -->|calls| ad9fd036_4003_1938_502d_6e15c37d2c31
  style a0127225_26e4_f097_c809_1f5f80482a5f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ssl/PemPrivateKeyParser.java lines 451–466

		static PKCS8EncodedKeySpec decrypt(byte[] bytes, @Nullable String password) {
			Assert.state(password != null, "Password is required for an encrypted private key");
			try {
				EncryptedPrivateKeyInfo keyInfo = new EncryptedPrivateKeyInfo(bytes);
				AlgorithmParameters algorithmParameters = keyInfo.getAlgParameters();
				String encryptionAlgorithm = getEncryptionAlgorithm(algorithmParameters, keyInfo.getAlgName());
				SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(encryptionAlgorithm);
				SecretKey key = keyFactory.generateSecret(new PBEKeySpec(password.toCharArray()));
				Cipher cipher = Cipher.getInstance(encryptionAlgorithm);
				cipher.init(Cipher.DECRYPT_MODE, key, algorithmParameters);
				return keyInfo.getKeySpec(cipher);
			}
			catch (IOException | GeneralSecurityException ex) {
				throw new IllegalArgumentException("Error decrypting private key", ex);
			}
		}

Subdomains

Called By

  • createKeySpecForPkcs8Encrypted()

Frequently Asked Questions

What does decrypt() do?
decrypt() is a function in the spring-boot codebase.
What does decrypt() call?
decrypt() calls 1 function(s): getEncryptionAlgorithm.
What calls decrypt()?
decrypt() is called by 1 function(s): createKeySpecForPkcs8Encrypted.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free