Skip to content

Issue when decrypting a ReadStream created from s3 Object #376

Closed
@rsuh

Description

@rsuh

Hi all,

What I'm trying to accomplish is getting an encrypted object from s3, creating a stream from it, then decrypting that stream.

const obj = s3.getObject({
        Bucket: 'bucket',
        Key: 'encrypted_file',
}).createReadStream()

const decryptedStream = obj.pipe(decryptStream(keyring))

I've confirmed that I'm able to successfully perform this operation if the file is downloaded locally, however it seems that pulling from s3 there seems to be an issue.

The issue is:

Error: Unsupported state or unable to authenticate data
    at Decipheriv.final (internal/crypto/cipher.js:174:29)
    at DecipherStream._onAuthTag (/Users/rsuh/code/riotgames/event-bus-producer/node_modules/@aws-crypto/decrypt-node/src/decipher_stream.ts:177:29)

What I've noticed is that the entire file is not getting decrypted, just a portion of it is, and then it falls over.

As far as I've seen from googling this may have to do with encoding headers, however those fixes have not worked for me.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions