public RSA(KeySafe key)
     : base()
 {
     algorithm = new RSACryptoServiceProvider();
     rsa       = (RSACryptoServiceProvider)algorithm;
     SetKey(key.Key);
 }
 public void SetKey(KeySafe key)
 {
     if (this.AlgorithmName() != key.Algorithm)
     {
         throw new ArgumentException("Algorithm in key is another than " + this.AlgorithmName());
     }
     algorithm.FromXmlString(key.Key);
 }
        public KeySafe GetKeySafe(bool includePrivateKey)
        {
            KeySafe key = new KeySafe();

            key.Key       = GetKey(includePrivateKey);
            key.Algorithm = this.AlgorithmName();
            return(key);
        }
 public void SetKey(KeySafe key)
 {
     if (this.AlgorithmName() != key.Algorithm)
     {
         throw new ArgumentException("Algorithm in key is another than " + this.AlgorithmName());
     }
     this.key    = key.Key;
     this.vector = key.Vector;
 }
        public KeySafe GetKeySafe()
        {
            KeySafe key = new KeySafe();

            key.Key       = this.Key;
            key.Vector    = this.Vector;
            key.Algorithm = this.AlgorithmName();

            return(key);
        }
 public static KeySafe FromXML(string xml)
 {
     try
     {
         KeySafe k = XMLSerializator.FromXml(xml, typeof(KeySafe)) as KeySafe;
         return(k);
     }
     catch (Exception e)
     {
         Log.Logger.Root.Error("", e);
         return(null);
     }
 }
 public TripleDES(KeySafe key)
     : this()
 {
     base.SetKey(key);
 }
 public Rijndael(KeySafe key)
     : this()
 {
     base.SetKey(key);
 }