Package org.microproxy
Record Class KeyMaterial
java.lang.Object
java.lang.Record
org.microproxy.KeyMaterial
- Record Components:
chain- the certificate chain, end-entity certificate first, then its issuers; not emptyprivateKey- the private key of the end-entity certificate
A certificate chain and the private key of its first certificate: what a TLS server presents.
Listeners that run a TLS handshake of their own rather than the JDK's, such as the HTTP/3
listener (QUIC carries TLS 1.3 itself), take their certificate in this form, from
SslContextSource.getKeyMaterial(String).-
Constructor Summary
ConstructorsConstructorDescriptionKeyMaterial(List<X509Certificate> chain, PrivateKey privateKey) Creates key material. -
Method Summary
Modifier and TypeMethodDescriptionchain()Returns the value of thechainrecord component.final booleanIndicates whether some other object is "equal to" this one.static KeyMaterialfromKeyStore(KeyStore keyStore, String alias, char[] password) The key entryaliasof a key store, or its first key entry whenaliasis null.final inthashCode()Returns a hash code value for this object.Returns the value of theprivateKeyrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
KeyMaterial
Creates key material.- Parameters:
chain- the certificate chain, end-entity certificate first; copiedprivateKey- the end-entity certificate's private key- Throws:
IllegalArgumentException- if the chain is empty
-
-
Method Details
-
fromKeyStore
public static KeyMaterial fromKeyStore(KeyStore keyStore, String alias, char[] password) throws GeneralSecurityException The key entryaliasof a key store, or its first key entry whenaliasis null.- Parameters:
keyStore- the loaded key storealias- the entry's alias, or null for the first key entrypassword- the entry's password- Returns:
- the entry's chain and private key
- Throws:
GeneralSecurityException- if the key store has no such key entry, or it cannot be read
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
chain
Returns the value of thechainrecord component.- Returns:
- the value of the
chainrecord component
-
privateKey
Returns the value of theprivateKeyrecord component.- Returns:
- the value of the
privateKeyrecord component
-