corda / net.corda.core.crypto / java.security.PublicKey

Extensions for java.security.PublicKey

containsAny

fun PublicKey.containsAny(otherKeys: Iterable<PublicKey>): Boolean

Checks whether any of the given keys matches a leaf on the CompositeKey tree or a single PublicKey.

isFulfilledBy

fun PublicKey.isFulfilledBy(otherKey: PublicKey): Boolean

Return true if otherKey fulfils the requirements of this PublicKey.

fun PublicKey.isFulfilledBy(otherKeys: Iterable<PublicKey>): Boolean

Return true if otherKeys fulfil the requirements of this PublicKey.

isValid

fun PublicKey.isValid(content: ByteArray, signature: DigitalSignature): Boolean

Utility to simplify the act of verifying a signature. In comparison to verify if the key and signature do not match it returns false rather than throwing an exception. Normally you should use the function which throws, as it avoids the risk of failing to test the result, but this is for uses such as java.security.Signature.verify implementations.

keys

val PublicKey.keys: Set<PublicKey>

Return a Set of the contained leaf keys if this is a CompositeKey. Otherwise, return a Set with a single element (this PublicKey). Note that leaf keys cannot be of type CompositeKey.

toStringShort

fun PublicKey.toStringShort(): String

Render a public key to its hash (in Base58) of its serialised form using the DL prefix.

verify

fun PublicKey.verify(content: ByteArray, signature: DigitalSignature): Boolean

Utility to simplify the act of verifying a signature.

fun PublicKey.verify(signatureData: ByteArray, clearData: ByteArray): Boolean

Helper function to verify a signature.