summary refs log tree commit diff
path: root/crypto/test
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-11-06 22:44:18 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-11-06 22:44:18 +0700
commit9dfd5af9b7ed63a33513599ae3e874c85dea15c3 (patch)
treed7342aad04bca424b56229d1d5eba558bbb4afd3 /crypto/test
parentCryptoApiRandomGenerator implements IDisposable (diff)
downloadBouncyCastle.NET-ed25519-9dfd5af9b7ed63a33513599ae3e874c85dea15c3.tar.xz
GOST 2012 private key reading
- see https://github.com/bcgit/bc-csharp/issues/365
Diffstat (limited to 'crypto/test')
-rw-r--r--crypto/test/src/openssl/test/ReaderTest.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/crypto/test/src/openssl/test/ReaderTest.cs b/crypto/test/src/openssl/test/ReaderTest.cs
index 78b06abc2..8cb66d6a6 100644
--- a/crypto/test/src/openssl/test/ReaderTest.cs
+++ b/crypto/test/src/openssl/test/ReaderTest.cs
@@ -3,6 +3,7 @@ using System.IO;
 
 using NUnit.Framework;
 
+using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.Cms;
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Crypto.Generators;
@@ -42,6 +43,23 @@ namespace Org.BouncyCastle.OpenSsl.Tests
             get { return "PEMReaderTest"; }
         }
 
+        [Test]
+        public void TestGost3410_2012()
+        {
+            string data =
+                "-----BEGIN PRIVATE KEY-----" +
+                "MEMCAQAwHAYGKoUDAgITMBIGByqFAwICIwEGByqFAwICHgEEIIBidanaO5G6Go8A" +
+                "thlDjR9rk4hij/PpjAQvXJr+zTqz" +
+                "-----END PRIVATE KEY-----";
+
+            using (var textReader = new StringReader(data))
+            {
+                var pemReader = new PemReader(textReader);
+                var pemObj = pemReader.ReadPemObject();
+                PrivateKeyFactory.CreateKey(pemObj.Content);
+            }
+        }
+
         public override void PerformTest()
         {
             IPasswordFinder pGet = new Password("secret".ToCharArray());