corda / net.corda.core.crypto / java.security.PrivateKey / sign

# sign

`fun PrivateKey.sign(clearData: ByteArray): ByteArray`

Helper function for signing.

### Parameters

`clearData` - the data/message to be signed in ByteArray form (usually the Merkle root).

### Exceptions

`IllegalArgumentException` - if the signature scheme is not supported for this private key.

`InvalidKeyException` - if the private key is invalid.

`SignatureException` - if signing is not possible due to malformed data or private key.

Return
the digital signature (in ByteArray) on the input message.

`fun PrivateKey.sign(metaData: MetaData): TransactionSignature`

Helper function for signing.

### Parameters

`metaDataFull` - tha attached MetaData object.

### Exceptions

`IllegalArgumentException` - if the signature scheme is not supported for this private key.

`InvalidKeyException` - if the private key is invalid.

`SignatureException` - if signing is not possible due to malformed data or private key.

Return
a DSWithMetaDataFull object.