mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 08:27:36 +00:00
Merge pull request #4783 from Infisical/misc/removed-byte-length-valida
misc: Allow any byte key when importing into KMS
This commit is contained in:
@@ -401,13 +401,6 @@ export const kmsServiceFactory = ({
|
|||||||
|
|
||||||
const cipher = symmetricCipherService(SymmetricKeyAlgorithm.AES_GCM_256);
|
const cipher = symmetricCipherService(SymmetricKeyAlgorithm.AES_GCM_256);
|
||||||
|
|
||||||
const expectedByteLength = getByteLengthForSymmetricEncryptionAlgorithm(algorithm as SymmetricKeyAlgorithm);
|
|
||||||
if (key.byteLength !== expectedByteLength) {
|
|
||||||
throw new BadRequestError({
|
|
||||||
message: `Invalid key length for ${algorithm}. Expected ${expectedByteLength} bytes but got ${key.byteLength} bytes`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const encryptedKeyMaterial = cipher.encrypt(key, ROOT_ENCRYPTION_KEY);
|
const encryptedKeyMaterial = cipher.encrypt(key, ROOT_ENCRYPTION_KEY);
|
||||||
const sanitizedName = name ? slugify(name) : slugify(alphaNumericNanoId(8).toLowerCase());
|
const sanitizedName = name ? slugify(name) : slugify(alphaNumericNanoId(8).toLowerCase());
|
||||||
const dbQuery = async (db: Knex) => {
|
const dbQuery = async (db: Knex) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user