parsePublicKey

suspend fun EncryptionAlgorithm.OAEPBased.parsePublicKey(key: ByteArray, keyId: String? = null, format: RSA.PublicKey.Format = RSA.PublicKey.Format.PEM, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): EncryptionKey.EncryptionOnlyKey(source)

Decodes an RSA-OAEP public key from a ByteArray for use with this algorithm.

The returned EncryptionKey is an EncryptionKey.EncryptionOnlyKey that can encrypt tokens but cannot decrypt them.

Return

an EncryptionKey wrapping the decoded RSA.OAEP.PublicKey.

Parameters

key

the public key material to decode.

keyId

optional key ID to associate with the decoded key. Defaults to null.

format

the format in which key is encoded. Defaults to RSA.PublicKey.Format.PEM.

cryptographyProvider

the provider used to perform key decoding.


suspend fun SigningAlgorithm.PKCS1Based.parsePublicKey(key: ByteArray, keyId: String? = null, format: RSA.PublicKey.Format = RSA.PublicKey.Format.PEM, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.VerifyOnlyKey(source)

Decodes an RSA PKCS#1 v1.5 public key from a ByteArray for use with this algorithm.

The returned SigningKey is a SigningKey.VerifyOnlyKey that can verify signatures but cannot produce them.

Return

a SigningKey wrapping the decoded RSA.PKCS1.PublicKey.

Parameters

key

the public key material to decode.

keyId

optional key ID to associate with the decoded key. Defaults to null.

format

the format in which key is encoded. Defaults to RSA.PublicKey.Format.PEM.

cryptographyProvider

the provider used to perform key decoding.


suspend fun SigningAlgorithm.PSSBased.parsePublicKey(key: ByteArray, keyId: String? = null, format: RSA.PublicKey.Format = RSA.PublicKey.Format.PEM, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.VerifyOnlyKey(source)

Decodes an RSA PSS public key from a ByteArray for use with this algorithm.

The returned SigningKey is a SigningKey.VerifyOnlyKey that can verify signatures but cannot produce them.

Return

a SigningKey wrapping the decoded RSA.PSS.PublicKey.

Parameters

key

the public key material to decode.

keyId

optional key ID to associate with the decoded key. Defaults to null.

format

the format in which key is encoded. Defaults to RSA.PublicKey.Format.PEM.

cryptographyProvider

the provider used to perform key decoding.


suspend fun SigningAlgorithm.ECDSABased.parsePublicKey(key: ByteArray, keyId: String? = null, format: EC.PublicKey.Format = EC.PublicKey.Format.RAW, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.VerifyOnlyKey(source)

Decodes an ECDSA public key from a ByteArray for use with this algorithm.

The returned SigningKey is a SigningKey.VerifyOnlyKey that can verify signatures but cannot produce them.

Return

a SigningKey wrapping the decoded ECDSA.PublicKey.

Parameters

key

the public key material to decode.

keyId

optional key ID to associate with the decoded key. Defaults to null.

format

the format in which key is encoded. Defaults to EC.PublicKey.Format.RAW.

cryptographyProvider

the provider used to perform key decoding.