KeyManagementService.sign - corda

corda / net.corda.core.node.services / KeyManagementService / sign

# sign

`@Suspendable abstract fun sign(bytes: ByteArray, publicKey: PublicKey): WithKey`

Using the provided signing PublicKey internally looks up the matching PrivateKey and signs the data.

### Parameters

`bytes` - The data to sign over using the chosen key.

`publicKey` - The PublicKey partner to an internally held PrivateKey, either derived from the node's primary identity, or previously generated via the freshKey method. If the PublicKey is actually a CompositeKey the first leaf signing key hosted by the node is used.

### Exceptions

`IllegalArgumentException` - if the input key is not a member of keys.

`@Suspendable abstract fun sign(signableData: SignableData, publicKey: PublicKey): TransactionSignature`

Using the provided signing PublicKey internally looks up the matching PrivateKey and signs the SignableData.

### Parameters

`signableData` - a wrapper over transaction id (Merkle root) and signature metadata.

`publicKey` - The PublicKey partner to an internally held PrivateKey, either derived from the node's primary identity, or previously generated via the freshKey method. If the PublicKey is actually a CompositeKey the first leaf signing key hosted by the node is used.

### Exceptions

`IllegalArgumentException` - if the input key is not a member of keys.