Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/aws_s3/node_modules/@aws-sdk/middleware-ssec/dist-es/ drwxr-xr-x | |
| Viewing file: Select action/file-type: export function ssecMiddleware(options) {
return (next) => async (args) => {
const input = { ...args.input };
const properties = [
{
target: "SSECustomerKey",
hash: "SSECustomerKeyMD5",
},
{
target: "CopySourceSSECustomerKey",
hash: "CopySourceSSECustomerKeyMD5",
},
];
for (const prop of properties) {
const value = input[prop.target];
if (value) {
let valueForHash;
if (typeof value === "string") {
if (isValidBase64EncodedSSECustomerKey(value, options)) {
valueForHash = options.base64Decoder(value);
}
else {
valueForHash = options.utf8Decoder(value);
input[prop.target] = options.base64Encoder(valueForHash);
}
}
else {
valueForHash = ArrayBuffer.isView(value)
? new Uint8Array(value.buffer, value.byteOffset, value.byteLength)
: new Uint8Array(value);
input[prop.target] = options.base64Encoder(valueForHash);
}
const hash = new options.md5();
hash.update(valueForHash);
input[prop.hash] = options.base64Encoder(await hash.digest());
}
}
return next({
...args,
input,
});
};
}
export const ssecMiddlewareOptions = {
name: "ssecMiddleware",
step: "initialize",
tags: ["SSE"],
override: true,
};
export const getSsecPlugin = (config) => ({
applyToStack: (clientStack) => {
clientStack.add(ssecMiddleware(config), ssecMiddlewareOptions);
},
});
export function isValidBase64EncodedSSECustomerKey(str, options) {
const base64Regex = /^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
if (!base64Regex.test(str))
return false;
try {
const decodedBytes = options.base64Decoder(str);
return decodedBytes.length === 32;
}
catch {
return false;
}
}
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0895 ]-- |