OpenSslKeyMaterialProvider Class — netty Architecture
Architecture documentation for the OpenSslKeyMaterialProvider class in OpenSslKeyMaterialProvider.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 738f20d6_5be5_1429_78fc_40bccc7b3b90["OpenSslKeyMaterialProvider"] 60cd9e5a_855e_5c14_6d31_4caf77304b35["OpenSslKeyMaterialProvider.java"] 738f20d6_5be5_1429_78fc_40bccc7b3b90 -->|defined in| 60cd9e5a_855e_5c14_6d31_4caf77304b35 e601d53a_e9e0_d71f_6011_93146d85e2c4["OpenSslKeyMaterialProvider()"] 738f20d6_5be5_1429_78fc_40bccc7b3b90 -->|method| e601d53a_e9e0_d71f_6011_93146d85e2c4 02d217fc_0044_e8f7_28eb_bd951f658c96["validateKeyMaterialSupported()"] 738f20d6_5be5_1429_78fc_40bccc7b3b90 -->|method| 02d217fc_0044_e8f7_28eb_bd951f658c96 b6527f12_42f4_a739_b702_4731088cea91["validateSupported()"] 738f20d6_5be5_1429_78fc_40bccc7b3b90 -->|method| b6527f12_42f4_a739_b702_4731088cea91 6743a7a4_b997_eb2f_fe51_3d1181546b15["X509KeyManager()"] 738f20d6_5be5_1429_78fc_40bccc7b3b90 -->|method| 6743a7a4_b997_eb2f_fe51_3d1181546b15 a72ea4c3_53f7_2633_f091_7119e840622f["OpenSslKeyMaterial()"] 738f20d6_5be5_1429_78fc_40bccc7b3b90 -->|method| a72ea4c3_53f7_2633_f091_7119e840622f ebc8f6ae_9dc6_c320_7ddd_245bea314351["destroy()"] 738f20d6_5be5_1429_78fc_40bccc7b3b90 -->|method| ebc8f6ae_9dc6_c320_7ddd_245bea314351
Relationship Graph
Source Code
handler/src/main/java/io/netty/handler/ssl/OpenSslKeyMaterialProvider.java lines 32–162
class OpenSslKeyMaterialProvider {
private final X509KeyManager keyManager;
private final String password;
OpenSslKeyMaterialProvider(X509KeyManager keyManager, String password) {
this.keyManager = keyManager;
this.password = password;
}
static void validateKeyMaterialSupported(X509Certificate[] keyCertChain, PrivateKey key, String keyPassword,
boolean allowSignatureFallback)
throws SSLException {
validateSupported(keyCertChain);
validateSupported(key, keyPassword, allowSignatureFallback);
}
private static void validateSupported(PrivateKey key, String password,
boolean allowSignatureFallback) throws SSLException {
if (key == null) {
return;
}
// Skip validation for keys that don't expose encoded material
// These will be handled by the key fallback mechanism
if (key.getEncoded() == null && allowSignatureFallback) {
return;
}
long pkeyBio = 0;
long pkey = 0;
try {
pkeyBio = toBIO(UnpooledByteBufAllocator.DEFAULT, key);
pkey = SSL.parsePrivateKey(pkeyBio, password);
} catch (Exception e) {
throw new SSLException("PrivateKey type not supported " + key.getFormat(), e);
} finally {
SSL.freeBIO(pkeyBio);
if (pkey != 0) {
SSL.freePrivateKey(pkey);
}
}
}
private static void validateSupported(X509Certificate[] certificates) throws SSLException {
if (certificates == null || certificates.length == 0) {
return;
}
long chainBio = 0;
long chain = 0;
PemEncoded encoded = null;
try {
encoded = PemX509Certificate.toPEM(UnpooledByteBufAllocator.DEFAULT, true, certificates);
chainBio = toBIO(UnpooledByteBufAllocator.DEFAULT, encoded.retain());
chain = SSL.parseX509Chain(chainBio);
} catch (Exception e) {
throw new SSLException("Certificate type not supported", e);
} finally {
SSL.freeBIO(chainBio);
if (chain != 0) {
SSL.freeX509Chain(chain);
}
if (encoded != null) {
encoded.release();
}
}
}
/**
* Returns the underlying {@link X509KeyManager} that is used.
*/
X509KeyManager keyManager() {
return keyManager;
}
/**
* Returns the {@link OpenSslKeyMaterial} or {@code null} (if none) that should be used during the handshake by
* OpenSSL.
*/
Source
Frequently Asked Questions
What is the OpenSslKeyMaterialProvider class?
OpenSslKeyMaterialProvider is a class in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/OpenSslKeyMaterialProvider.java.
Where is OpenSslKeyMaterialProvider defined?
OpenSslKeyMaterialProvider is defined in handler/src/main/java/io/netty/handler/ssl/OpenSslKeyMaterialProvider.java at line 32.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free