Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,12 @@ export const handleArgs = (args: string[]) => {
JSON.stringify({
'@opentdf/sdk': version,
tdfSpecVersion,
// Features explicitly implemented by this CLI build, as opposed to
// values merely accepted by an option's `choices` list (e.g.
// --rewrapKeyType has long accepted "mlkem:768" because it shares
// PUBLIC_KEY_ALGORITHMS with the KAS-managed-key encap path, which
// predates the rewrap session key actually decapsulating ML-KEM).
supportedFeatures: ['session-key-mlkem'],
})
)
.alias('version', 'V')
Expand Down
1 change: 1 addition & 0 deletions lib/tdf3/src/tdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,7 @@ export async function decryptStreamFrom(
allowedKases: allowList,
dpopKeys: cfg.dpopKeys,
cryptoService: cfg.cryptoService,
wrappingKeyAlgorithm: cfg.wrappingKeyAlgorithm,
});
// async function unwrapKey(manifest: Manifest, allowedKases: string[], authProvider: AuthProvider | AppIdAuthProvider, publicKey: string, privateKey: string, entity: EntityObject) {
const keyForDecryption = await cfg.keyMiddleware(reconstructedKey);
Expand Down
10 changes: 9 additions & 1 deletion lib/tests/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ const kas: RequestListener = async (req, res) => {
name: 'ECDH',
namedCurve: 'P-256',
},
false,
true,
['deriveBits', 'deriveKey']
);
const kek = await keyAgreement(sessionKeyPair.privateKey, clientPublicKey!, {
Expand All @@ -450,7 +450,15 @@ const kas: RequestListener = async (req, res) => {
const entityWrappedKey = new Uint8Array(iv.length + cek.byteLength);
entityWrappedKey.set(iv);
entityWrappedKey.set(new Uint8Array(cek), iv.length);
// The client needs the KAS's ephemeral EC public key to complete its own
// ECDH derivation; without this the client can never recompute `kek`.
const sessionPublicKeySpki = await crypto.subtle.exportKey(
'spki',
sessionKeyPair.publicKey
);
Comment thread
dmihalcik-virtru marked this conversation as resolved.
const sessionPublicKey = formatAsPem(sessionPublicKeySpki, 'PUBLIC KEY');
const reply = create(RewrapResponseSchema, {
sessionPublicKey,
responses: [
create(PolicyRewrapResultSchema, {
results: [
Expand Down
Loading