Ejemplo n.º 1
0
 public async Task <byte[]> Unwrap(KeyVaultAlgorithm algorithm, byte[] wrappedKey)
 {
     if (!algorithm.CanCryptOrWrap())
     {
         throw new InvalidOperationException("Cannot unwrap with this algorithm type.");
     }
     return((await Client.UnwrapKeyAsync(Identifier.Identifier, algorithm.GetConfigurationString(), wrappedKey)).Result);
 }
Ejemplo n.º 2
0
 public async Task <byte[]> Encrypt(KeyVaultAlgorithm algorithm, byte[] plainText)
 {
     if (!algorithm.CanCryptOrWrap())
     {
         throw new InvalidOperationException("Cannot encrypt with this algorithm type.");
     }
     return((await Client.EncryptAsync(Identifier.Identifier, algorithm.GetConfigurationString(), plainText)).Result);
 }