Use of SymmetricKey for encryption/decryption
Developersimform opened this issue · comments
Hey @leif-ibsen
I guess there is no documentation in README for encryption/decryption with SymmetricKey.
I am struggling with encryption/decryption with use of SymmetricKey.
Could you please update the README ?
Also Could you please add example?
Thank you
In SwiftECC you can only encrypt and decrypt things with the ECIES protocol.
To encrypt something you need the public key you want to encrypt to.
You must specify whether to use AES128, AES192 or AES256 and you can also specify which block mode to use (CBC, ECB, ...)
To decrypt you need the corresponding private key.
You never deal directly with the AES symmetric keys, ECIES takes care of that behind the scenes.
There are examples in the READ.me sections 'Encryption and Decryption' and 'AEAD Encryption and Decryption'
PS: Given a private key and an encrypted message,
you can get the symmetric key that was used to encrypt the message
using the private key function 'getKeyAndMac'