aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/s3_constants/crypto.go
blob: 398e2b6696873d207c32d81a4c11fd0094d1d634 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package s3_constants

// Cryptographic constants
const (
	// AES block and key sizes
	AESBlockSize = 16 // 128 bits for AES block size (IV length)
	AESKeySize   = 32 // 256 bits for AES-256 keys

	// SSE algorithm identifiers
	SSEAlgorithmAES256 = "AES256"
	SSEAlgorithmKMS    = "aws:kms"

	// SSE type identifiers for response headers and internal processing
	SSETypeC   = "SSE-C"
	SSETypeKMS = "SSE-KMS"
	SSETypeS3  = "SSE-S3"

	// S3 multipart upload limits and offsets
	S3MaxPartSize = 5 * 1024 * 1024 * 1024 // 5GB - AWS S3 maximum part size limit

	// Multipart offset calculation for unique IV generation
	// Using 8GB offset between parts (larger than max part size) to prevent IV collisions
	// Critical for CTR mode encryption security in multipart uploads
	PartOffsetMultiplier = int64(1) << 33 // 8GB per part offset

	// KMS validation limits based on AWS KMS service constraints
	MaxKMSEncryptionContextPairs = 10  // Maximum number of encryption context key-value pairs
	MaxKMSKeyIDLength            = 500 // Maximum length for KMS key identifiers

	// S3 multipart upload limits based on AWS S3 service constraints
	MaxS3MultipartParts = 10000 // Maximum number of parts in a multipart upload (1-10,000)
)