TrustedCredentials

class TrustedCredentials(crypto: CryptoBackend, credentials: List<AuthenticationCredential>, certificateValidator: CertificateValidator? = null) : CredentialResolver(source)

A CredentialResolver over a fixed set of trusted credentials:

  • kid matches credentials whose AuthenticationCredential.kid equals it;

  • x5t matches X.509 credentials whose thumbprint equals it;

  • kccs is accepted when an identical CCS is trusted (raw public keys are their own trust anchors, RFC 9528 Appendix D.3);

  • x5chain is accepted when its end-entity certificate is trusted, or else when certificateValidator accepts the chain.

What is trusted with and without a certificateValidator:

val resolver = CredentialResolver { id ->
trusted.resolve(id).filter { it.certificate?.subjectCommonName in allowedNames }
}

No CertificateValidator implementation ships with kcoap yet. A validator that accepts every chain, such as an empty test stub, makes any certificate authenticate, self-signed ones included.

Constructors

Link copied to clipboard
constructor(crypto: CryptoBackend, credentials: List<AuthenticationCredential>, certificateValidator: CertificateValidator? = null)

Functions

Link copied to clipboard
open suspend override fun resolve(identifier: CredentialIdentifier): List<AuthenticationCredential>

The trusted credentials identifier may refer to, most likely first.