Пример #1
0
        public KeysViewModel GetRandomRSAKeys()
        {
            var rsa = new RSACryptoServiceProvider(1024);

            return(new KeysViewModel
            {
                PublicKey = KeyExporter.ExportPublicKey(rsa),
                PrivateKey = KeyExporter.ExportPrivateKey(rsa)
            });
        }
Пример #2
0
        public void Convert_xml_key_to_pem()
        {
            var name = "test.startliste2.info";

            var keyStore = new FileKeyStore(Environment.CurrentDirectory);
            var key      = keyStore.GetOrCreateKey(name);
            var sut      = new KeyExporter(Environment.CurrentDirectory);

            // Act
            sut.Save(key.ExportParameters(true), name, KeyFormat.Pem);

            Assert.True(File.Exists(Path.Combine(Environment.CurrentDirectory, "test.startliste.info.pem")));
        }