From d368d84a3c8275082e22860c445f950a0ac908f5 Mon Sep 17 00:00:00 2001 From: Dawid Heyman Date: Wed, 20 Nov 2024 15:59:51 +0100 Subject: [PATCH] Removed encryption types --- lib/file_transfer_agent/encrypt_util.js | 21 ++++++++++++++++- lib/file_transfer_agent/encryption_types.js | 25 --------------------- 2 files changed, 20 insertions(+), 26 deletions(-) delete mode 100644 lib/file_transfer_agent/encryption_types.js diff --git a/lib/file_transfer_agent/encrypt_util.js b/lib/file_transfer_agent/encrypt_util.js index 7cd84ef67..5764ab05f 100644 --- a/lib/file_transfer_agent/encrypt_util.js +++ b/lib/file_transfer_agent/encrypt_util.js @@ -9,13 +9,32 @@ const fs = require('fs'); const Logger = require('../logger'); const AES_BLOCK_SIZE = 128; const blockSize = parseInt(AES_BLOCK_SIZE / 8); // in bytes -const { AES_ECB, AES_GCM, AES_CBC } = require('./encryption_types'); const QUERY_STAGE_MASTER_KEY = 'queryStageMasterKey'; const BASE64 = 'base64'; const DEFAULT_AAD = Buffer.from(''); const AUTH_TAG_LENGTH_IN_BYTES = 16; +const AES_CBC = { + cipherName: function (keySizeInBytes) { + return `aes-${keySizeInBytes * 8}-cbc`; + }, + ivSize: 16 +}; + +const AES_ECB = { + cipherName: function (keySizeInBytes) { + return `aes-${keySizeInBytes * 8}-ecb`; + } +}; + +const AES_GCM = { + cipherName: function (keySizeInBytes) { + return `aes-${keySizeInBytes * 8}-gcm`; + }, + ivSize: 12 +}; + // Material Descriptor function MaterialDescriptor(smkId, queryId, keySize) { return { diff --git a/lib/file_transfer_agent/encryption_types.js b/lib/file_transfer_agent/encryption_types.js deleted file mode 100644 index 002e65f8a..000000000 --- a/lib/file_transfer_agent/encryption_types.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2024 Snowflake Computing Inc. All rights reserved. - */ - -const AES_CBC = { - cipherName: function (keySizeInBytes) { - return `aes-${keySizeInBytes * 8}-cbc`; - }, - ivSize: 16 -}; - -const AES_ECB = { - cipherName: function (keySizeInBytes) { - return `aes-${keySizeInBytes * 8}-ecb`; - } -}; - -const AES_GCM = { - cipherName: function (keySizeInBytes) { - return `aes-${keySizeInBytes * 8}-gcm`; - }, - ivSize: 12 -}; - -module.exports = { AES_CBC, AES_GCM, AES_ECB }; \ No newline at end of file