Package-level declarations

Types

Link copied to clipboard
@Serializable
data class ConfirmationClaim(val jsonWebKey: JsonWebKey? = null, val encryptedSymmetricKey: JweEncrypted? = null, val keyId: String? = null, val jsonWebKeySetUrl: String? = null, val jsonWebKeyThumbprint: String? = null)

Structure to declare posession of a particular proof-of-possesion key, to be included in JsonWebToken.confirmationClaim

Link copied to clipboard
@Serializable(with = JwaSerializer::class)
interface JsonWebAlgorithm
Link copied to clipboard
@Serializable
data class JsonWebKey(val algorithm: JsonWebAlgorithm? = null, val curve: ECCurve? = null, val e: ByteArray? = null, val k: ByteArray? = null, val keyOperations: Set<String>? = null, val keyId: String? = null, val type: JwkType? = null, val n: ByteArray? = null, val publicKeyUse: String? = null, val x: ByteArray? = null, val certificateChain: CertificateChain? = null, val certificateSha1Thumbprint: ByteArray? = null, val certificateUrl: String? = null, val certificateSha256Thumbprint: ByteArray? = null, val y: ByteArray? = null) : SpecializedCryptoPublicKey

JSON Web Key as per RFC 7517.

Link copied to clipboard
@Serializable
data class JsonWebKeySet(val keys: Collection<JsonWebKey>)

JSON Web Key Set as per RFC 7517

Link copied to clipboard
@Serializable
data class JsonWebToken(val issuer: String? = null, val subject: String? = null, val audience: String? = null, val nonce: String? = null, val notBefore: Instant? = null, val issuedAt: Instant? = null, val expiration: Instant? = null, val jwtId: String? = null, val confirmationClaim: ConfirmationClaim? = null, val httpMethod: String? = null, val httpTargetUrl: String? = null, val accessTokenHash: String? = null)

Content of a JWT (JsonWebToken), with many optional keys, since no claim is strongly required.

Link copied to clipboard
object JwaSerializer : KSerializer<JsonWebAlgorithm>
Link copied to clipboard
@Serializable(with = JweAlgorithmSerializer::class)
sealed class JweAlgorithm : JsonWebAlgorithm
Link copied to clipboard
object JweAlgorithmSerializer : KSerializer<JweAlgorithm>
Link copied to clipboard
data class JweDecrypted<T : Any>(val header: JweHeader, val payload: T)

Representation of a decrypted JSON Web Encryption object, i.e. header and payload.

Link copied to clipboard
data class JweEncrypted(val header: JweHeader, val headerAsParsed: ByteArray, val encryptedKey: ByteArray? = null, val iv: ByteArray, val ciphertext: ByteArray, val authTag: ByteArray)

Representation of an encrypted JSON Web Encryption object, consisting of its 5 parts: Header, encrypted key, IV, ciphertext, authentication tag.

Link copied to clipboard
object JweEncryptedSerializer : KSerializer<JweEncrypted>
Link copied to clipboard

Supported JWE algorithms.

Link copied to clipboard
object JweEncryptionSerializer : KSerializer<JweEncryption?>
Link copied to clipboard
@Serializable
data class JweHeader(val algorithm: JweAlgorithm?, val encryption: JweEncryption?, val keyId: String? = null, val type: String? = null, val contentType: String? = null, val jsonWebKey: JsonWebKey? = null, val jsonWebKeyUrl: String? = null, val ephemeralKeyPair: JsonWebKey? = null, val agreementPartyUInfo: ByteArray? = null, val agreementPartyVInfo: ByteArray? = null, val initializationVector: ByteArray? = null, val authenticationTag: ByteArray? = null, val certificateUrl: String? = null, val certificateChain: CertificateChain? = null, val certificateSha1Thumbprint: ByteArray? = null, val certificateSha256Thumbprint: ByteArray? = null)

Header of a JweEncrypted or JweDecrypted.

Link copied to clipboard
@Serializable(with = JwkTypeSerializer::class)
enum JwkType : Enum<JwkType>

Supported JSON Web Key types.

Link copied to clipboard
object JwkTypeSerializer : KSerializer<JwkType?>
Link copied to clipboard

Since we support only JWS algorithms (with one exception), this class is called what it's called.

Link copied to clipboard
object JwsAlgorithmSerializer : KSerializer<JwsAlgorithm>
Link copied to clipboard
Link copied to clipboard
@Serializable
data class JwsHeader(val keyId: String? = null, val type: String? = null, val algorithm: JwsAlgorithm, val contentType: String? = null, val certificateChain: CertificateChain? = null, val notBefore: Instant? = null, val issuedAt: Instant? = null, val expiration: Instant? = null, val jsonWebKey: JsonWebKey? = null, val jsonWebKeySetUrl: String? = null, val certificateUrl: String? = null, val certificateSha1Thumbprint: ByteArray? = null, val certificateSha256Thumbprint: ByteArray? = null, val attestationJwt: String? = null)

Header of a JwsSigned.

Link copied to clipboard
data class JwsSigned<out P : Any>(val header: JwsHeader, val payload: P, val signature: CryptoSignature.RawByteEncodable, val plainSignatureInput: ByteArray)

Representation of a signed JSON Web Signature object, i.e. consisting of header, payload and signature.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun CryptoPublicKey.toJsonWebKey(keyId: String? = this.jwkId): JsonWebKey

Converts a CryptoPublicKey to a JsonWebKey

Link copied to clipboard

Tries to find a matching JWS algorithm. Note that JWS imposes curve restrictions on ECDSA based on the digest.