diff --git a/src/Stratis.SmartContracts.CLR/SCL/ECRecover.cs b/src/Stratis.SmartContracts.CLR/SCL/ECRecover.cs index 5180789d8c..4234c45e9e 100644 --- a/src/Stratis.SmartContracts.CLR/SCL/ECRecover.cs +++ b/src/Stratis.SmartContracts.CLR/SCL/ECRecover.cs @@ -9,6 +9,13 @@ namespace Stratis.SCL.Crypto { public static class ECRecover { + /// + /// Takes a message and signatures and recovers the list of addresses that produced the signatures. + /// + /// The list of signatures of the message. + /// The message that was signed. + /// The addresses returned are intersected with these addresses (if not null). + /// The list of addresses that produced the signatures and constrained to the list provided in . private static Address[] VerifySignatures(string[] signatures, byte[] message, Address[] addresses) { try @@ -37,17 +44,30 @@ private static Address[] VerifySignatures(string[] signatures, byte[] message, A /// The addresses returned are intersected with these addresses. /// The list of addresses that produced the signatures and constrained to the list provided in . /// The boolean value returned only indicates whether the operation could be performed. The number of verified addresses should still be checked. - public static bool TryVerifySignatures(string[] signatures, byte[] message, Address[] addresses, out Address[] verifiedAddresses) + public static bool TryGetVerifiedSignatures(string[] signatures, byte[] message, Address[] addresses, out Address[] verifiedAddresses) { if (addresses == null) { verifiedAddresses = null; return false; - } + } verifiedAddresses = VerifySignatures(signatures, message, addresses); return verifiedAddresses != null; } + + /// + /// Takes a message and signatures and recovers the list of addresses that produced the signatures. + /// + /// The list of signatures of the message. + /// The message that was signed. + /// The addresses returned are intersected with these addresses. + /// The list of addresses that produced the signatures and constrained to the list provided in . + /// The boolean value returned only indicates whether the operation could be performed. The number of verified addresses should still be checked. + public static bool TryGetVerifiedSignatures(string[] signatures, string message, Address[] addresses, out Address[] verifiedAddresses) + { + return TryGetVerifiedSignatures(signatures, System.Text.Encoding.ASCII.GetBytes(message), addresses, out verifiedAddresses); + } } }