Class PeerIdentityTrustManager

java.lang.Object
javax.net.ssl.X509ExtendedTrustManager
pt.unl.fct.di.novasys.babel2.ssl.PeerIdentityTrustManager
All Implemented Interfaces:
TrustManager, X509TrustManager

public class PeerIdentityTrustManager extends X509ExtendedTrustManager
An X509ExtendedTrustManager that validates peer certificates according to the Babel 2 / libp2p TLS identity certificate pattern.

Specifically, this trust manager verifies that:

  1. The certificate dates are currently valid.
  2. The certificate is self-signed by the TLS ephemeral public key.
  3. The certificate contains the custom Babel 2 TLS identity extension (OID "2.25.143997576564619623049175376840488616895").
  4. The extension contains a valid long-term static public key and a signature over the ephemeral key.
  5. The signature is verified against the static public key.
  6. If an authorization allowlist is configured, the SHA-256 hash of the static public key matches an authorized peer ID.

Upon successful authentication, the verified long-term peer public key and hex peer ID are stored in the active SSLSession attributes under "pt.unl.fct.di.novasys.babel2.ssl.PeerPublicKey" and "pt.unl.fct.di.novasys.babel2.ssl.PeerId".