I want to combine RSA and ECC. First of all, a particular file is encrypted with the RSA algorithm and then that encrypted data is again encrypted with ECC algorithm.
However, can I use RSA to encrypt and ECC to sign, or do I have it backwards?
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It only takes a minute to sign up.Sign up to join this community
Both RSA and ECC can be used to encrypt/decrypt or sign/verify data. Neither is efficient when it comes to doing either (for larger amounts of data). That's why in general a symmetric cipher such as AES (in a specific mode) is used to encrypt/decrypt the bulk of the data. A secure hash such as SHA-512 is used to perform a one-way compression when doing a sign / verify method. A combined asymmetric algorithm and symmetric algorithm is called a hybrid cryptosystem.
The most common/recent methods would be to use RSA-OAEP and AES-GCM for encryption and RSA-PSS with SHA-512 for signing. For ECC you can do EC-IES with AES-GCM for encryption and ECDSA with SHA-512 for signing. These can be mixed any way you want. Other variants are possible of course.
Generally you would sign the message first and then encrypt it. Otherwise somebody could strip the signature from the file and sign it himself. You will need a minimum of two key pairs of course, one for the sender and one of the receiver. The AES keys should be generated specifically for encrypting the single message.