From 04f36cc265afae9f59e03089a402c53bc0fadfe0 Mon Sep 17 00:00:00 2001 From: piouslove <305053045@qq.com> Date: Wed, 19 Sep 2018 15:46:55 +0800 Subject: [PATCH 1/2] modify sig nonce --- contracts/EthereumDIDRegistry.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/EthereumDIDRegistry.sol b/contracts/EthereumDIDRegistry.sol index b253672..d1620b9 100644 --- a/contracts/EthereumDIDRegistry.sol +++ b/contracts/EthereumDIDRegistry.sol @@ -45,7 +45,7 @@ contract EthereumDIDRegistry { function checkSignature(address identity, uint8 sigV, bytes32 sigR, bytes32 sigS, bytes32 hash) internal returns(address) { address signer = ecrecover(hash, sigV, sigR, sigS); require(signer == identityOwner(identity)); - nonce[identity]++; + nonce[signer]++; return signer; } From 20e40f04dba9fcb946e0518899cb735586427832 Mon Sep 17 00:00:00 2001 From: piouslove <305053045@qq.com> Date: Thu, 20 Sep 2018 10:58:06 +0800 Subject: [PATCH 2/2] modify key of nonce --- contracts/EthereumDIDRegistry.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/EthereumDIDRegistry.sol b/contracts/EthereumDIDRegistry.sol index d1620b9..f0afbb4 100644 --- a/contracts/EthereumDIDRegistry.sol +++ b/contracts/EthereumDIDRegistry.sol @@ -109,7 +109,7 @@ contract EthereumDIDRegistry { } function setAttributeSigned(address identity, uint8 sigV, bytes32 sigR, bytes32 sigS, bytes32 name, bytes value, uint validity) public { - bytes32 hash = keccak256(byte(0x19), byte(0), this, nonce[identity], identity, "setAttribute", name, value, validity); + bytes32 hash = keccak256(byte(0x19), byte(0), this, nonce[identityOwner(identity)], identity, "setAttribute", name, value, validity); setAttribute(identity, checkSignature(identity, sigV, sigR, sigS, hash), name, value, validity); } @@ -123,7 +123,7 @@ contract EthereumDIDRegistry { } function revokeAttributeSigned(address identity, uint8 sigV, bytes32 sigR, bytes32 sigS, bytes32 name, bytes value) public { - bytes32 hash = keccak256(byte(0x19), byte(0), this, nonce[identity], identity, "revokeAttribute", name, value); + bytes32 hash = keccak256(byte(0x19), byte(0), this, nonce[identityOwner(identity)], identity, "revokeAttribute", name, value); revokeAttribute(identity, checkSignature(identity, sigV, sigR, sigS, hash), name, value); }