mirror of
https://github.com/corda/corda.git
synced 2025-05-30 14:14:29 +00:00
Minor: more cleanups
This commit is contained in:
parent
bea799c60d
commit
ac337240a6
@ -74,7 +74,7 @@ object Crypto {
|
|||||||
"EDDSA_ED25519_SHA512",
|
"EDDSA_ED25519_SHA512",
|
||||||
"EdDSA",
|
"EdDSA",
|
||||||
EdDSAEngine(),
|
EdDSAEngine(),
|
||||||
EdDSAKeyFactory(),
|
EdDSAKeyFactory,
|
||||||
net.i2p.crypto.eddsa.KeyPairGenerator(), // EdDSA engine uses a custom KeyPairGenerator Vs BouncyCastle.
|
net.i2p.crypto.eddsa.KeyPairGenerator(), // EdDSA engine uses a custom KeyPairGenerator Vs BouncyCastle.
|
||||||
EdDSANamedCurveTable.getByName("ed25519-sha-512"),
|
EdDSANamedCurveTable.getByName("ed25519-sha-512"),
|
||||||
256,
|
256,
|
||||||
|
@ -7,4 +7,4 @@ import java.security.KeyFactory
|
|||||||
* This is required as a [SignatureScheme] requires a [java.security.KeyFactory] property, but i2p has
|
* This is required as a [SignatureScheme] requires a [java.security.KeyFactory] property, but i2p has
|
||||||
* its own KeyFactory for EdDSA, thus this actually a Proxy Pattern over i2p's KeyFactory.
|
* its own KeyFactory for EdDSA, thus this actually a Proxy Pattern over i2p's KeyFactory.
|
||||||
*/
|
*/
|
||||||
class EdDSAKeyFactory : KeyFactory(net.i2p.crypto.eddsa.KeyFactory(), null, "EDDSA_ED25519_SHA512")
|
object EdDSAKeyFactory : KeyFactory(net.i2p.crypto.eddsa.KeyFactory(), null, "EDDSA_ED25519_SHA512")
|
||||||
|
@ -424,14 +424,12 @@ class CryptoUtilsTest {
|
|||||||
val privKey: EdDSAPrivateKey = keyPair.private as EdDSAPrivateKey
|
val privKey: EdDSAPrivateKey = keyPair.private as EdDSAPrivateKey
|
||||||
val pubKey: EdDSAPublicKey = keyPair.public as EdDSAPublicKey
|
val pubKey: EdDSAPublicKey = keyPair.public as EdDSAPublicKey
|
||||||
|
|
||||||
val kf = EdDSAKeyFactory()
|
|
||||||
|
|
||||||
// Encode and decode private key.
|
// Encode and decode private key.
|
||||||
val privKey2 = kf.generatePrivate(PKCS8EncodedKeySpec(privKey.encoded))
|
val privKey2 = EdDSAKeyFactory.generatePrivate(PKCS8EncodedKeySpec(privKey.encoded))
|
||||||
assertEquals(privKey2, privKey)
|
assertEquals(privKey2, privKey)
|
||||||
|
|
||||||
// Encode and decode public key.
|
// Encode and decode public key.
|
||||||
val pubKey2 = kf.generatePublic(X509EncodedKeySpec(pubKey.encoded))
|
val pubKey2 = EdDSAKeyFactory.generatePublic(X509EncodedKeySpec(pubKey.encoded))
|
||||||
assertEquals(pubKey2, pubKey)
|
assertEquals(pubKey2, pubKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class DBTransactionMappingStorage : StateMachineRecordedTransactionMappingStorag
|
|||||||
|
|
||||||
private class InnerState {
|
private class InnerState {
|
||||||
val stateMachineTransactionMap = TransactionMappingsMap()
|
val stateMachineTransactionMap = TransactionMappingsMap()
|
||||||
val updates = PublishSubject.create<StateMachineTransactionMapping>()!!
|
val updates: PublishSubject<StateMachineTransactionMapping> = PublishSubject.create()
|
||||||
}
|
}
|
||||||
private val mutex = ThreadBox(InnerState())
|
private val mutex = ThreadBox(InnerState())
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class DistributedImmutableMap<K : Any, V : Any>(val db: Database, tableName: Str
|
|||||||
/** Gets a value for the given [Commands.Get.key] */
|
/** Gets a value for the given [Commands.Get.key] */
|
||||||
fun get(commit: Commit<Commands.Get<K, V>>): V? {
|
fun get(commit: Commit<Commands.Get<K, V>>): V? {
|
||||||
commit.use {
|
commit.use {
|
||||||
val key = commit.operation().key
|
val key = it.operation().key
|
||||||
return databaseTransaction(db) { map[key] }
|
return databaseTransaction(db) { map[key] }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ class VaultSoftLockManager(val vault: VaultService, smm: StateMachineManager) {
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
smm.changes.subscribe { (logic, addOrRemove, id) ->
|
smm.changes.subscribe { (logic, addOrRemove, id) ->
|
||||||
if (addOrRemove == AddOrRemove.REMOVE && trackingFlowIds.contains(id.uuid)) {
|
if (addOrRemove == AddOrRemove.REMOVE && id.uuid in trackingFlowIds) {
|
||||||
log.trace { "$addOrRemove Flow name ${logic.javaClass} with id $id" }
|
log.trace { "$addOrRemove Flow name ${logic.javaClass} with id $id" }
|
||||||
unregisterSoftLocks(id, logic)
|
unregisterSoftLocks(id, logic)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user