File tree 1 file changed +16
-0
lines changed
onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/contract
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,27 @@ import java.util.*
20
20
data class SignatureData (private val content : ByteArray , private val signature : DigitalSignature ) {
21
21
22
22
companion object {
23
+
24
+ /* *
25
+ * Creates a signature from the specified content and private key.
26
+ *
27
+ * @param content The content to sign.
28
+ * @param privateKey The private key to sign the content.
29
+ * @return Returns a new signature containing the content and signed data.
30
+ */
23
31
fun create (content : ByteArray , privateKey : PrivateKey ): SignatureData {
24
32
val signature = privateKey.sign(content)
25
33
return SignatureData (content, signature)
26
34
}
27
35
36
+ /* *
37
+ * Creates a signature from the specified content by resolving the signing key from the service hub.
38
+ *
39
+ * @param content The content to sign.
40
+ * @param publicKey The public key to resolve from the service hub.
41
+ * @param serviceHub The service hub to resolve the public key.
42
+ * @return Returns a new signature containing the content and signed data.
43
+ */
28
44
fun create (content : ByteArray , publicKey : PublicKey , serviceHub : ServiceHub ): SignatureData {
29
45
val signature = serviceHub.keyManagementService.sign(content, publicKey)
30
46
return SignatureData (content, signature.withoutKey())
You can’t perform that action at this time.
0 commit comments