示例#1
0
            public void ShouldSuccessfullyEncryptData()
            {
                // Arrange
                const string testData = "This is a test";
                var          service  = new RSAEncryptionService();

                // Act
                var cipherText = service.EncryptString(testData, _TestData.PublicKey);

                // Assert
                Assert.True(!string.IsNullOrWhiteSpace(cipherText));
            }
示例#2
0
            public void ShouldSuccessfullyDecryptData()
            {
                // Arrange
                const string testData   = "This is a test";
                var          service    = new RSAEncryptionService();
                var          cipherText = service.EncryptString(testData, _TestData.PublicKey);

                // Act
                var plainText = service.DecryptString(cipherText, _TestData.PrivateKey);

                // Assert
                Assert.Equal(testData, plainText);
            }
示例#3
0
            public void ShouldReturnBase64EncodedString()
            {
                // Arrange
                const string testData   = "This is a test";
                var          service    = new RSAEncryptionService();
                var          cipherText = service.EncryptString(testData, _TestData.PublicKey);

                // Act
                var bytes = Convert.FromBase64String(cipherText);

                // Assert
                Assert.True(bytes.Length > 0);
            }