From 93fa138d20bd5bb41d57ac23a14f6aebc6ad3560 Mon Sep 17 00:00:00 2001 From: Martin Prikryl Date: Thu, 5 Nov 2020 07:21:15 +0100 Subject: [PATCH] Max length of AWS access key is nowadays 128 See https://docs.aws.amazon.com/IAM/latest/APIReference/API_AccessKey.html Also exposing the key and region length limit in libs3 API --- inc/libs3.h | 12 ++++++++++++ inc/util.h | 4 +--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/inc/libs3.h b/inc/libs3.h index 3318ef2..84f50ff 100644 --- a/inc/libs3.h +++ b/inc/libs3.h @@ -240,6 +240,18 @@ extern "C" { #define S3_DEFAULT_REGION "us-east-1" +/** + * Maximal length of AWS access key + */ +#define S3_MAX_ACCESS_KEY_ID_LENGTH 128 + + +/** + * Maximal length of AWS region name + */ +#define S3_MAX_REGION_LENGTH 32 + + /** ************************************************************************** * Enumerations ************************************************************************** **/ diff --git a/inc/util.h b/inc/util.h index 8c66a55..b43154c 100644 --- a/inc/util.h +++ b/inc/util.h @@ -69,12 +69,10 @@ #define MAX_CANONICALIZED_RESOURCE_SIZE \ (1 + 255 + 1 + MAX_URLENCODED_KEY_SIZE + (sizeof("?torrent") - 1) + 1) -#define MAX_ACCESS_KEY_ID_LENGTH 32 - // Maximum length of a credential string // ///s3/aws4_request #define MAX_CREDENTIAL_SIZE \ - (MAX_ACCESS_KEY_ID_LENGTH + 1) + 8 + 1 + 32 + sizeof("/s3/aws4_request") + (S3_MAX_ACCESS_KEY_ID_LENGTH + 1) + 8 + 1 + S3_MAX_REGION_LENGTH + sizeof("/s3/aws4_request") // Utilities -----------------------------------------------------------------