Example #1
0
        public async Task <string> Decrypt(BigInt.BigInt[] encrypt, PrivateKey privateKey, IProgress <double> progress = default)
        {
            var decrypted = new int[encrypt.Length];
            await Task.Run(() =>
            {
                for (var i = 0; i < encrypt.Length; i++)
                {
                    decrypted[i] = (byte)RsaEncrypting.DecryptNumber(encrypt[i], privateKey);
                    progress?.Report(Math.Round(100.0 / encrypt.Length *i));
                }

                progress?.Report(100);
            });

            return(StringUtils.ConvertNumbersToString(decrypted, _alphabet));
        }
Example #2
0
 public void NumberDecryptionTest(int encrypted, int original) =>
 Assert.AreEqual(original, RsaEncrypting.DecryptNumber(encrypted, PrivateKey));