A c program to encrypt and decrypt a file using two separate keys

Can I encrypt and decrypt a file using two separate keys? i.e using public key