1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//! The [`CellDecryptor`] seam used by the result-set decode path to turn an
//! encrypted cell's cipher bytes back into a plaintext [`ColumnValues`].
//!
//! Implementations resolve the plaintext column encryption key (CEK) for a
//! column's [`CryptoMetadata`] and run the AEAD decryption plus
//! denormalization. The trait is intentionally synchronous so the row parsers
//! and [`ParserContext`](crate::io::token_stream::ParserContext) can hold a
//! `dyn CellDecryptor` without conditional compilation. The concrete
//! implementation (`ResolvedCekDecryptor`, in [`crate::security::keystore`]) is
//! built once per result set after the CEKs have been resolved, keeping
//! per-cell decryption free of `async`, allocation, and lock contention.
// The trait is consumed by the result-set decode path and the keystore's
// `ResolvedCekDecryptor` implementor.
use crateTdsResult;
use crateColumnValues;
use crateCryptoMetadata;
/// Decrypts a single encrypted cell using already-resolved column encryption
/// keys.
pub