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

createKeySpecForPkcs8() — spring-boot Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  0657dd8b_3de2_0475_9532_1e654ca3d0cb["createKeySpecForPkcs8()"]
  769485d7_3d05_2a17_e40f_ab5969f3158b["isType()"]
  0657dd8b_3de2_0475_9532_1e654ca3d0cb -->|calls| 769485d7_3d05_2a17_e40f_ab5969f3158b
  8e95391a_e33e_a2ec_4af6_7d51fccc5224["getContents()"]
  0657dd8b_3de2_0475_9532_1e654ca3d0cb -->|calls| 8e95391a_e33e_a2ec_4af6_7d51fccc5224
  49107b8c_e444_7ae5_a698_ba5067480277["of()"]
  0657dd8b_3de2_0475_9532_1e654ca3d0cb -->|calls| 49107b8c_e444_7ae5_a698_ba5067480277
  style 0657dd8b_3de2_0475_9532_1e654ca3d0cb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

core/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemPrivateKeyParser.java lines 167–183

	private static PKCS8EncodedKeySpec createKeySpecForPkcs8(byte[] bytes, @Nullable String password) {
		DerElement ecPrivateKey = DerElement.of(bytes);
		Assert.state(ecPrivateKey != null, "Unable to find private key");
		Assert.state(ecPrivateKey.isType(ValueType.ENCODED, TagType.SEQUENCE),
				"Key spec should be an ASN.1 encoded sequence");
		DerElement version = DerElement.of(ecPrivateKey.getContents());
		Assert.state(version != null && version.isType(ValueType.PRIMITIVE, TagType.INTEGER),
				"Key spec should start with version");
		DerElement sequence = DerElement.of(ecPrivateKey.getContents());
		Assert.state(sequence != null && sequence.isType(ValueType.ENCODED, TagType.SEQUENCE),
				"Key spec should contain private key");
		DerElement algorithmId = DerElement.of(sequence.getContents());
		Assert.state(algorithmId != null && algorithmId.isType(ValueType.PRIMITIVE, TagType.OBJECT_IDENTIFIER),
				"Key spec container object identifier");
		String algorithmName = ALGORITHMS.get(EncodedOid.of(algorithmId));
		return (algorithmName != null) ? new PKCS8EncodedKeySpec(bytes, algorithmName) : new PKCS8EncodedKeySpec(bytes);
	}

Domain

Subdomains

Frequently Asked Questions

What does createKeySpecForPkcs8() do?
createKeySpecForPkcs8() is a function in the spring-boot codebase.
What does createKeySpecForPkcs8() call?
createKeySpecForPkcs8() calls 3 function(s): getContents, isType, of.

Analyze Your Own Codebase

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

Try Supermodel Free