Secure OS Software for Linux
1753909 Members
8831 Online
108810 Solutions
New Discussion юеВ

Re: How to create AES128 encrypted key with openssl

 
SOLVED
Go to solution
Bensi Bose TC
Advisor

How to create AES128 encrypted key with openssl

Hi experts,

Please help me to create AES 128 encrypted openssl certificate which can be used for Apache SSL configuration.

I am able to create RSA/DSA keys with AES128 encryption using following command.
# openssl genrsa -aes128 -out key.pem

Is it possible to create AES 128 encrypted key without using RSA/DSA algorithms.

Thanks
Bensi Bose TC
3 REPLIES 3
Matti_Kurkela
Honored Contributor
Solution

Re: How to create AES128 encrypted key with openssl

Sure, just get 128 bits of data from /dev/random and you have an AES 128 key that can be used to encrypt anything you like (and decrypt it too). But you can never make an SSL certificate out of such a key.

To understand the problem, you'll need to know a bit about encryption algorithms.

There are two types of encryption algorithms (ciphers).

A symmetric encryption uses the same key both to encrypt and to decrypt. Both the sender and the receiver must have the same key, and nothing prevents the receiver to use his/her key for sending data too. AES is a symmetric encryption algorithm.

An asymmetric encryption involves a pair of keys: when data is encrypted using one key, that same key cannot decrypt it. To decrypt the data, the other half of the key pair is needed. The pair of keys is created together, because both keys must have some algorithm-specific computational properties in common. This is exactly what "openssl genrsa" does.

This is why there must be a special procedure for creating the keys for an asymmetric encryption algorithm, but symmetric algorithms can usually use any piece of random data as a key. The only requirement is usually that the key is long enough for the algorithm to work.

To create SSL certificates, you need an asymmetric encryption algorithm. Using just a symmetric encryption won't work: it would mean that everyone connecting to your Apache would have to have the encryption key, and that means everyone could easily pretend to be the server if they wished.

On the other hand, asymmetric encryption algorithms are much more work computationally than symmetric ones: systems like SSL/TLS are based on using asymmetric encryption to securely exchange a pair of session keys, and then using a regular symmetric encryption algorithm to protect the data within the session.

# openssl genrsa -aes128 -out key.pem
This command uses AES 128 only to protect the RSA key pair with a passphrase, just in case an unauthorized person can get the key file.

When your Apache server starts up, it must decrypt the key in memory to use it. The fact that you Apache server may or may not use AES encryption with a session key when communicating with HTTPS clients is not at all related to the encryption algorithm used to protect the RSA/DSA key: these are two completely separate operations.

MK
MK
Bensi Bose TC
Advisor

Re: How to create AES128 encrypted key with openssl

Thanks MK for your valid inputs.

I need some more information from you. I want the clarification that whether there is any other way to generate the pem files or other ways of generating ssl certificates complying to the Export regulations. I would like to use if mail communication also.

Thanks
Bensi Bose TC
Matti_Kurkela
Honored Contributor

Re: How to create AES128 encrypted key with openssl

What export regulations?
I have no idea what export regulations your country might have.

This Crypto Law Survey (which might not be up-to-date) does not have any information about _export_ regulations in India:

1.http://www.cryptolaw.org


As far as I know, to use SSL/TLS in a typical way, either RSA or DSA *must* be used for certificates.

Exporting key files should not be a problem anyway: export regulations are usually more concerned about the technology that _uses_ the keys. In this case, that technology is in the OpenSSL library, which is already available world-wide.

You should never be exporting *your* keys to your clients; if the clients understand security at all, they should create their own keys anyway.

I think I don't really understand your problem. You're apparently trying to create SSL keys, which is the first step in getting a X.509 certificate. However, you say you wish to avoid using RSA/DSA algorithms, which are pretty fundamental to SSL and X.509 certificates.

The .pem files are just a specific format for storing X.509 certificates and their keys: storing other types of encryption key material using the .pem file format is probably possible, but not necessarily very useful.

So either you're trying to do something impossible or there is a misunderstanding somewhere.

MK

MK