0
votes
$\begingroup$

I've been playing with Apple's CryptoKit (their effort to make their old CommonCrypto lib more modern and easy to use via Swift, their programming language).

I'm interested to see how portable it is...

They use boxes, similar to libsodium.

Interestingly they only support AES-GCM and ChaChaPoly for authSym, and a handful of curves for Asym (P-256 & Curve25519 being most notable).

Anyway, I'm just trying to decrypt some test data manually (using OpenSSL or whatever) using the raw outputs I've extracted from the debug code I wrote, and whilst I can encrypt and decrypt in Swift I'd love to test this elsewhere to check portability.

This is AES-GCM-256,

Key Base64: nUSfBvhz2HSSo575uCOK3ewTibD7jXsp6f2aPfP3dTo=

Nonce:m2A7P8c5r7wmczXD

Ciphertext:uEU5otv81AMjG9wCxg==

Tag:w1lj7fumWRQ7hdJCXwkqCw==

Can anyone help me use OpenSSL on command line to decrypt?

I've been trying OpenSSL enc aes-gcm-256 -a -d without getting it working (-a for base64, -d for decrypt)...

$\endgroup$

1 Answer 1

2
votes
$\begingroup$

OpenSSL cli doesn't support authenticated encryption modes like CCM and GCM. The reason behind that is the lack of security if the IV/nonce is reused. Using OpenSSL cli, IV management totally rely on the user, who tend to make mistakes... In order to avoid catastrophic failures, they simply decided to not allow AEAD.

I guess the easiest way is to do a simple Python script. I would advice PyCryptodome, you can even find an example which suite your needs.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.