Ejemplo n.º 1
0
        public static void CreateDefault(string certificateThumbprint, string filePath)
        {
            var config = new AesConfiguration
            {
                CertificateThumbprint = certificateThumbprint,
                BlockSize             = 256,
                CipherMode            = CipherMode.CBC,
                Padding      = PaddingMode.PKCS7,
                EncryptedKey = Encrypt(GetRandomBytes(32), certificateThumbprint),
                EncryptedIv  = Encrypt(GetRandomBytes(32), certificateThumbprint)
            };

            byte[] bytes = XmlSerialization.Serialize(config);
            File.WriteAllBytes(filePath, bytes);
        }
Ejemplo n.º 2
0
 public Aes() : this(AesConfiguration.FromFile("crypto.config"))
 {
 }
Ejemplo n.º 3
0
 public Aes(AesConfiguration configuration)
 {
     this.configuration = configuration;
 }