コード例 #1
0
 public void TestDecrypt()
 {
     using (var stream = File.OpenRead(Util.TestDataPath(TEST_DATA, "cryptkey.zip")))
         using (var keySet = new BlobKeySet(stream))
             using (var crypter = new Crypter(keySet))
             {
                 var cipherText = (WebBase64)File.ReadAllText(Util.TestDataPath(TEST_DATA, "crypt.out"));
                 Expect(crypter.Decrypt(cipherText), Is.EqualTo(input));
             }
 }
コード例 #2
0
 public void TestSign()
 {
     using (var stream = File.OpenRead(Util.TestDataPath(TEST_DATA, "cryptkey.zip")))
         using (var keySet = new BlobKeySet(stream))
             using (var crypter = new Crypter(keySet))
                 using (var signstream = File.OpenRead(Util.TestDataPath(TEST_DATA, "signkey.zip")))
                     using (var signkeySet = new BlobKeySet(signstream))
                         using (var verifier = new Verifier(new EncryptedKeySet(signkeySet, crypter)))
                         {
                             var sig = (WebBase64)File.ReadAllText(Util.TestDataPath(TEST_DATA, "sign.out"));
                             Expect(verifier.Verify(input, sig), Is.True);
                         }
 }