mirror of
https://github.com/corda/corda.git
synced 2025-06-22 17:09:00 +00:00
Merge remote-tracking branch 'open/master' into os-merge-2018-06-18-17_42
This commit is contained in:
@ -42,6 +42,8 @@ import java.util.jar.JarInputStream
|
||||
@CordaSerializable
|
||||
interface Attachment : NamedByHash {
|
||||
fun open(): InputStream
|
||||
|
||||
@JvmDefault
|
||||
fun openAsJAR(): JarInputStream {
|
||||
val stream = open()
|
||||
try {
|
||||
@ -55,6 +57,7 @@ interface Attachment : NamedByHash {
|
||||
* Finds the named file case insensitively and copies it to the output stream.
|
||||
* @throws FileNotFoundException if the given path doesn't exist in the attachment.
|
||||
*/
|
||||
@JvmDefault
|
||||
fun extractFile(path: String, outputTo: OutputStream) = openAsJAR().use { it.extractFile(path, outputTo) }
|
||||
|
||||
/**
|
||||
|
@ -43,6 +43,7 @@ interface TransactionWithSignatures : NamedByHash {
|
||||
* @throws SignatureException if any signatures are invalid or unrecognised.
|
||||
* @throws SignaturesMissingException if any signatures should have been present but were not.
|
||||
*/
|
||||
@JvmDefault
|
||||
@Throws(SignatureException::class)
|
||||
fun verifyRequiredSignatures() = verifySignaturesExcept(emptySet())
|
||||
|
||||
@ -58,6 +59,7 @@ interface TransactionWithSignatures : NamedByHash {
|
||||
* @throws SignatureException if any signatures are invalid or unrecognised.
|
||||
* @throws SignaturesMissingException if any signatures should have been present but were not.
|
||||
*/
|
||||
@JvmDefault
|
||||
@Throws(SignatureException::class)
|
||||
fun verifySignaturesExcept(vararg allowedToBeMissing: PublicKey) {
|
||||
verifySignaturesExcept(Arrays.asList(*allowedToBeMissing))
|
||||
@ -75,6 +77,7 @@ interface TransactionWithSignatures : NamedByHash {
|
||||
* @throws SignatureException if any signatures are invalid or unrecognised.
|
||||
* @throws SignaturesMissingException if any signatures should have been present but were not.
|
||||
*/
|
||||
@JvmDefault
|
||||
@Throws(SignatureException::class)
|
||||
fun verifySignaturesExcept(allowedToBeMissing: Collection<PublicKey>) {
|
||||
val needed = getMissingSigners() - allowedToBeMissing
|
||||
@ -92,6 +95,7 @@ interface TransactionWithSignatures : NamedByHash {
|
||||
* @throws InvalidKeyException if the key on a signature is invalid.
|
||||
* @throws SignatureException if a signature fails to verify.
|
||||
*/
|
||||
@JvmDefault
|
||||
@Throws(InvalidKeyException::class, SignatureException::class)
|
||||
fun checkSignaturesAreValid() {
|
||||
for (sig in sigs) {
|
||||
@ -110,6 +114,7 @@ interface TransactionWithSignatures : NamedByHash {
|
||||
/**
|
||||
* Return the [PublicKey]s for which we still need signatures.
|
||||
*/
|
||||
@JvmDefault
|
||||
fun getMissingSigners(): Set<PublicKey> {
|
||||
val sigKeys = sigs.map { it.by }.toSet()
|
||||
// TODO Problem is that we can get single PublicKey wrapped as CompositeKey in allowedToBeMissing/mustSign
|
||||
|
Reference in New Issue
Block a user