Exemplo n.º 1
0
        public async Task Export_Import()
        {
            const string name = "self";
            var          _    = await _keyStoreService.CreateAsync(name, "ed25519", 0);

            var password = "******".ToCharArray();
            var pem      = await _keyStoreService.ExportAsync(name, password);

            Assert.That(pem, Does.StartWith("-----BEGIN ENCRYPTED PRIVATE KEY-----"));

            var keys = await _keyStoreService.ListAsync();

            var self = keys.Single(k => k.Name == name);

            await _keyStoreService.RemoveAsync("clone");

            var clone = await _keyStoreService.ImportAsync("clone", pem, password);

            Assert.AreEqual("clone", clone.Name);
            Assert.AreEqual(self.Id, clone.Id);
        }
Exemplo n.º 2
0
 public async Task <IKey> ImportAsync(string name, string pem, char[] password, CancellationToken cancel)
 {
     return(await _keyStoreService.ImportAsync(name, pem, password, cancel).ConfigureAwait(false));
 }