Esempio n. 1
0
        /// <summary>
        /// Decrypts the provided message using the public key associated with the specified DID using the anonymous-encryption scheme.
        /// </summary>
        /// <param name="wallet">The wallet containing the DID and associated secret key to use for decryption.</param>
        /// <param name="did">The DID of the encrypting party to use for verification.</param>
        /// <param name="encryptedMsg">The message to decrypt.</param>
        /// <returns>An asynchronous <see cref="Task{T}"/> that resolves to a byte array containing the decrypted message.</returns>
        public static Task <byte[]> DecryptSealedAsync(Wallet wallet, string did, byte[] encryptedMsg)
        {
            var taskCompletionSource = new TaskCompletionSource <byte[]>();
            var commandHandle        = PendingCommands.Add(taskCompletionSource);

            var commandResult = IndyNativeMethods.indy_decrypt_sealed(
                commandHandle,
                wallet.Handle,
                did,
                encryptedMsg,
                encryptedMsg.Length,
                _decryptSealedCallback
                );

            CallbackHelper.CheckResult(commandResult);

            return(taskCompletionSource.Task);
        }