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

Extensions for java.security.PublicKey

containsAny

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

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

isFulfilledBy

Return true if otherKey fulfils the requirements of this PublicKey.

fun PublicKey.isFulfilledBy(otherKey: PublicKey): Boolean

Return true if otherKeys fulfil the requirements of this PublicKey.

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

isValid

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.

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

keys

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.

val PublicKey.keys: Set<PublicKey>

toStringShort

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

fun PublicKey.toStringShort(): String

verify

Utility to simplify the act of verifying a signature.

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

Helper function to verify a signature.

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