ENT-1906: Publish DJVM artifact with its dependency information. (#3897)

Also migrate enclavelet code into testing:common jar.
This commit is contained in:
Chris Rankin
2018-09-05 15:57:12 +01:00
committed by PokeyBot
parent 9373c0fb8e
commit e3ece00bea
4 changed files with 31 additions and 34 deletions

View File

@ -1,11 +1,8 @@
@file:JvmName("Enclavelet")
package net.corda.deterministic.txverify
import net.corda.core.serialization.deserialize
import net.corda.core.transactions.LedgerTransaction
import net.corda.deterministic.bytesOfResource
import net.corda.deterministic.common.LocalSerializationRule
import net.corda.deterministic.common.TransactionVerificationRequest
import net.corda.deterministic.common.verifyInEnclave
import net.corda.finance.contracts.asset.Cash.Commands.*
import org.assertj.core.api.Assertions.assertThat
import org.junit.ClassRule
@ -30,23 +27,3 @@ class EnclaveletTest {
assertThat(e).hasMessageContaining("Required ${Move::class.java.canonicalName} command")
}
}
/**
* Returns either null to indicate success when the transactions are validated, or a string with the
* contents of the error. Invoked via JNI in response to an enclave RPC. The argument is a serialised
* [TransactionVerificationRequest].
*
* Note that it is assumed the signatures were already checked outside the sandbox: the purpose of this code
* is simply to check the sensitive, app specific parts of a transaction.
*
* TODO: Transaction data is meant to be encrypted under an enclave-private key.
*/
@Throws(Exception::class)
private fun verifyInEnclave(reqBytes: ByteArray) {
deserialize(reqBytes).verify()
}
private fun deserialize(reqBytes: ByteArray): LedgerTransaction {
return reqBytes.deserialize<TransactionVerificationRequest>()
.toLedgerTransaction()
}