Beispiel #1
0
 public bool BallotIsValid()
 {
     using (var key = ECSKey.LoadHexPublicKey(SigningPublicKey))
     {
         return(key.Verify(UTF8Encoding.Unicode.GetBytes(BallotData), BallotSignature));
     }
 }
Beispiel #2
0
        public void LockBallotToChain(ECSKey key, byte[] previousBallotHash)
        {
            PreviousBallotHash = previousBallotHash;
            SHA256Managed hashstring = new SHA256Managed();

            BallotHash          = hashstring.ComputeHash(GetBallotHashingData());
            BallotHashSignature = key.Sign(BallotHash);
            LockDate            = DateTime.UtcNow;
        }
Beispiel #3
0
 private bool ballotHasValidHash()
 {
     using (var key = ECSKey.LoadHexPublicKey(SigningPublicKey))
     {
         SHA256Managed hashstring = new SHA256Managed();
         var           ballotHash = hashstring.ComputeHash(GetBallotHashingData());
         if (ballotHash.SequenceEqual(BallotHash))
         {
             return(key.Verify(BallotHash, BallotHashSignature));
         }
         return(false);
     }
 }
Beispiel #4
0
 public void SignSecret(ECSKey key, string secret)
 {
     SecretSignature  = key.Sign(UTF8Encoding.Unicode.GetBytes(secret));
     SigningPublicKey = key.PublicKey;
 }
Beispiel #5
0
 public void SignBallot(ECSKey key)
 {
     BallotSignature  = key.Sign(UTF8Encoding.Unicode.GetBytes(BallotData));
     SigningPublicKey = key.PublicKey;
 }
Beispiel #6
0
 public void SignSecret(ECSKey key, string secret)
 {
     SecretSignature = key.Sign(UTF8Encoding.Unicode.GetBytes(secret));
     SigningPublicKey = key.PublicKey;
 }
Beispiel #7
0
 public void SignBallot(ECSKey key)
 {
     BallotSignature = key.Sign(UTF8Encoding.Unicode.GetBytes(BallotData));
     SigningPublicKey = key.PublicKey;
 }
Beispiel #8
0
 public void LockBallotToChain(ECSKey key, byte[] previousBallotHash)
 {
     PreviousBallotHash = previousBallotHash;
     SHA256Managed hashstring = new SHA256Managed();
     BallotHash = hashstring.ComputeHash(GetBallotHashingData());
     BallotHashSignature = key.Sign(BallotHash);
     LockDate = DateTime.UtcNow;
 }