mirror of
https://github.com/corda/corda.git
synced 2024-12-21 05:53:23 +00:00
Undo test deletion which got lost in commit 391c6bf66f
. (#4145)
This commit is contained in:
parent
fcea655bf1
commit
777026eb79
@ -25,8 +25,8 @@ object JarSignatureTestUtils {
|
||||
.waitFor())
|
||||
}
|
||||
|
||||
fun Path.generateKey(alias: String, password: String, name: String) =
|
||||
executeProcess("keytool", "-genkey", "-keystore", "_teststore", "-storepass", "storepass", "-keyalg", "RSA", "-alias", alias, "-keypass", password, "-dname", name)
|
||||
fun Path.generateKey(alias: String, password: String, name: String, keyalg: String = "RSA") =
|
||||
executeProcess("keytool", "-genkey", "-keystore", "_teststore", "-storepass", "storepass", "-keyalg", keyalg, "-alias", alias, "-keypass", password, "-dname", name)
|
||||
|
||||
fun Path.createJar(fileName: String, vararg contents: String) =
|
||||
executeProcess(*(arrayOf("jar", "cvf", fileName) + contents))
|
||||
|
@ -8,6 +8,7 @@ import net.corda.core.JarSignatureTestUtils.updateJar
|
||||
import net.corda.core.identity.Party
|
||||
import net.corda.testing.core.ALICE_NAME
|
||||
import net.corda.testing.core.BOB_NAME
|
||||
import net.corda.testing.core.CHARLIE_NAME
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.After
|
||||
import org.junit.AfterClass
|
||||
@ -129,6 +130,16 @@ class JarSignatureCollectorTest {
|
||||
assertFailsWith<SecurityException> { dir.getJarSigners(FILENAME) }
|
||||
}
|
||||
|
||||
// Signing with EC algorithm produces META-INF/*.EC file name not compatible with JAR File Spec however it's compatible with java.util.JarVerifier
|
||||
// and our JarSignatureCollector
|
||||
@Test
|
||||
fun `one signer with EC algorithm`() {
|
||||
dir.generateKey(CHARLIE, CHARLIE_PASS, CHARLIE_NAME.toString(), "EC")
|
||||
dir.createJar(FILENAME, "_signable1", "_signable2")
|
||||
val key = dir.signJar(FILENAME, CHARLIE, CHARLIE_PASS)
|
||||
assertEquals(listOf(key), dir.getJarSigners(FILENAME)) // We only used CHARLIE's distinguished name, so the keys will be different.
|
||||
}
|
||||
|
||||
private fun signAsAlice() = dir.signJar(FILENAME, ALICE, ALICE_PASS)
|
||||
private fun signAsBob() = dir.signJar(FILENAME, BOB, BOB_PASS)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user