예제 #1
0
        public override async Task SaveCertPrivateKeyToFile(string name, string filename)
        {
            var password   = PasswordGenerator.GeneratePassword(64);
            var privateKey = await _store.GetPrivateKeyAsync(name, true);

            var bytes = privateKey.Export(X509ContentType.Pfx, password);
            await File.WriteAllBytesAsync(filename, bytes);

            var passwordFile = (filename.EndsWith(".pfx") ? filename.Substring(0, filename.Length - 4) : filename) +
                               ".pw";
            await File.WriteAllTextAsync(passwordFile, password);
        }