Example #1
0
        private static CryptographicKey getKey(SymmetricKeyAlgorithmProvider Algorithm)
        {
            IBuffer keymaterial = CryptographicBuffer.CreateFromByteArray(ByteUtils.getBytes(KEY.Substring(0, SIZE_IV)));

            CryptographicKey _key = null;
            try
            {
                _key = Algorithm.CreateSymmetricKey(keymaterial);
            }
            catch (ArgumentException ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }

            return _key;
        }
Example #2
0
 public Encryption(string key, string iv)
 {
     this.alg = SymmetricKeyAlgorithmProvider.OpenAlgorithm(SymmetricAlgorithmNames.AesCbc);
     this.key = key;
     this.iv = iv;
 }
Example #3
0
		public SymmetricKeyEncryptor (SymmetricKeyAlgorithmProvider algorithm, CryptographicKey key, IBuffer iv)
		{
			this.algorithm = algorithm;
			this.key = key;
			this.iv = iv;
		}
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SymmetricKeyAlgorithmProvider"/> class.
 /// </summary>
 /// <param name="algorithm">The algorithm.</param>
 public SymmetricKeyAlgorithmProvider(SymmetricAlgorithm algorithm)
 {
     this.algorithm = algorithm;
     this.platform  = Platform.SymmetricKeyAlgorithmProvider.OpenAlgorithm(GetAlgorithmName(algorithm));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SymmetricKeyAlgorithmProvider"/> class.
 /// </summary>
 /// <param name="algorithm">The algorithm.</param>
 public SymmetricKeyAlgorithmProvider(SymmetricAlgorithm algorithm)
 {
     this.algorithm = algorithm;
     this.platform = Platform.SymmetricKeyAlgorithmProvider.OpenAlgorithm(GetAlgorithmName(algorithm));
 }
 public UAPSymmetricKeyAlgorithmProvider(SymmetricKeyAlgorithmProvider provider)
 {
     this.provider = provider;
 }