AnonymousExplicit

data class AnonymousExplicit(val privateKey: PrivateKey, val algorithm: Algorithm = when (privateKey) { is EcPrivateKey -> privateKey.curve.defaultSigningAlgorithmFullySpecified is RsaPrivateKey -> Algorithm.RS256 is MlDsaPrivateKey -> privateKey.algorithm is MlKemPrivateKey -> privateKey.algorithm }) : AsymmetricKey.Anonymous, AsymmetricKey.Explicit

AsymmetricKey which is both AsymmetricKey.Anonymous and AsymmetricKey.Explicit.

Constructors

Link copied to clipboard
constructor(privateKey: PrivateKey, algorithm: Algorithm = when (privateKey) { is EcPrivateKey -> privateKey.curve.defaultSigningAlgorithmFullySpecified is RsaPrivateKey -> Algorithm.RS256 is MlDsaPrivateKey -> privateKey.algorithm is MlKemPrivateKey -> privateKey.algorithm })

Properties

Link copied to clipboard
open override val algorithm: Algorithm

Signature algorithm

Link copied to clipboard
open override val certChain: X509CertChain?

X509 certificate chain for the key, corresponds to x5c header value in JWT.

Link copied to clipboard

Private key as EcPrivateKey

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val privateKey: PrivateKey

Private key that is used for signing.

Link copied to clipboard
open override val publicKey: PublicKey

Public key that corresponds to the private key used for signing

Link copied to clipboard

Private key as RsaPrivateKey

Link copied to clipboard
Link copied to clipboard
open override val subject: String

Entity to which the key belongs; key id for named key, common name for the keys with the certificate chain.

Functions

Link copied to clipboard
open override fun close()

Closes the key, zeroing any underlying private key material if this is an explicit key.

Link copied to clipboard
suspend fun keyAgreement(otherKey: PublicKey): SecureByteString
open suspend override fun keyAgreement(otherKey: EcPublicKey): SecureByteString

Performs Key Agreement using this key and otherKey.

Link copied to clipboard
open suspend override fun sign(message: ByteArray): Signature

Signs message with this key.

Link copied to clipboard
suspend fun signEc(message: ByteArray): EcSignature

Convenience method to sign message when this is an EC key.

Link copied to clipboard
suspend fun signMlDsa(message: ByteArray): MlDsaSignature

Convenience method to sign message when this is an ML-DSA key.

Link copied to clipboard
suspend fun signRsa(message: ByteArray): RsaSignature

Convenience method to sign message when this is an RSA key.