Example #1
0
        public void EmptyPemShouldReturnEmptyByteArray()
        {
            var pem = "";

            var result = PemDecoder.DecodeSection(pem, "Bar");

            result.Length.Should().Be(0);
        }
Example #2
0
        public void PemWithoutMatchingSectionShouldReturnEmptyByteArray()
        {
            var pem = @"-----BEGIN Foo-----
data...
-----END Foo-----";

            var result = PemDecoder.DecodeSection(pem, "Bar");

            result.Length.Should().Be(0);
        }
Example #3
0
        public void PemWithSingleSectionThatMatchesShouldReturnDecodedData()
        {
            var pem = @"-----BEGIN Foo-----
QmFy
-----END Foo-----";

            var result = PemDecoder.DecodeSection(pem, "Foo");

            result.Length.Should().Be(3);
            Encoding.UTF8.GetString(result).Should().Be("Bar");
        }