コード例 #1
0
        public void EncryptTest(string keyFilePath)
        {
            // Arrange
            var rsa = new RSACryptoServiceProvider();

            rsa.ImportPrivateKeyFromPemFile(keyFilePath);
            string plainText = "laggage coding changes myworld";

            // Act
            string encrypted = rsa.EncryptToBase64(plainText);
            string decrypted = rsa.DecryptFromBase64(encrypted);

            // Assert
            Assert.Equal(plainText, decrypted);
        }