Encrypt transactions for local format as soon as they are received

This commit is contained in:
adam.houston 2022-03-23 13:04:08 +00:00
parent e1a6b5fd09
commit 9a6b8d2417
2 changed files with 9 additions and 4 deletions

View File

@ -2,7 +2,7 @@
# because some versions here need to be matched by app authors in
# their own projects. So don't get fancy with syntax!
cordaVersion=4.8.5.6-CONCLAVE-SNAPSHOT
cordaVersion=4.8.5.7-CONCLAVE-SNAPSHOT
versionSuffix=
gradlePluginsVersion=5.0.12
kotlinVersion=1.2.71

View File

@ -111,6 +111,11 @@ abstract class ReceiveTransactionFlowBase<T> @JvmOverloads constructor(private v
try {
if (encrypted) {
val validatedTxSvc = serviceHub.validatedTransactions
val encryptedTxSvc = serviceHub.encryptedTransactionService
val usableEncryptedTransaction = encryptedTxSvc.encryptTransactionForLocal(
encryptedTx ?: throw IllegalStateException("And encrypted transaction is required")
)
val signedTxs = it.dependencies.mapNotNull {
validatedTxId ->
@ -123,16 +128,16 @@ abstract class ReceiveTransactionFlowBase<T> @JvmOverloads constructor(private v
}.toSet()
val verifiableTx = EncryptedVerifiableTxAndDependencies(
encryptedTx!!,
usableEncryptedTransaction,
signedTxs,
encryptedTxs
)
if (checkSufficientSignatures) {
val encryptedAndVerifiedTx = serviceHub.encryptedTransactionService.enclaveVerifyWithSignatures(verifiableTx)
val encryptedAndVerifiedTx = encryptedTxSvc.enclaveVerifyWithSignatures(verifiableTx)
serviceHub.recordEncryptedTransactions(listOf(encryptedAndVerifiedTx))
} else {
serviceHub.encryptedTransactionService.enclaveVerifyWithoutSignatures(verifiableTx)
encryptedTxSvc.enclaveVerifyWithoutSignatures(verifiableTx)
}
it