How to use S3 SSE C (Server Side Encryption with Client Provided Keys) on NodeJS

Question:

How do I use SSE C encryption on NodeJS? I tried the below but got an error

Problem is I get “The secret key was invalid for the specified algorithm”

Whats wrong? They key I tried using was generated like:

I used the key for SSECustomerKey

Answer:

Try generating your key this way:

const ssecKey = Buffer.alloc(32, 'your key')

Then you can use it like

Leave a Reply