1
0
mirror of synced 2024-11-16 03:03:22 +01:00

DES Encrypt/Decrypt - checks length of IV string

Checks the length of IV string when encrypting.  DES encrypt/decrypt test swas updated to use utf8 instead of HEX.
This commit is contained in:
Storms-Engineering 2019-10-12 09:42:13 -08:00
parent 3472484601
commit 3e93580aa4
3 changed files with 12 additions and 2 deletions

View File

@ -73,6 +73,11 @@ class DESDecrypt extends Operation {
DES uses a key length of 8 bytes (64 bits).
Triple DES uses a key length of 24 bytes (192 bits).`);
}
if (iv.length !== 8) {
throw new OperationError(`Invalid IV length: ${iv.length} bytes
DES uses an IV length of 8 bytes (64 bits).`);
}
input = Utils.convertToByteString(input, inputType);

View File

@ -73,6 +73,11 @@ class DESEncrypt extends Operation {
DES uses a key length of 8 bytes (64 bits).
Triple DES uses a key length of 24 bytes (192 bits).`);
}
if (iv.length !== 8) {
throw new OperationError(`Invalid IV length: ${iv.length} bytes
DES uses an IV length of 8 bytes (64 bits).`);
}
input = Utils.convertToByteString(input, inputType);

View File

@ -400,7 +400,7 @@ color: white;
},
iv: {
string: "threetwo",
option: "Hex",
option: "utf8",
},
mode: "ECB",
});
@ -415,7 +415,7 @@ color: white;
},
iv: {
string: "threetwo",
option: "Hex",
option: "utf8",
},
mode: "ECB",
});