Pawel Jakub Dawidek wrote:
Hello.

We're trying to get as small RSA private key as possible, because we
are short in space (we want to store it on a smart card, so every byte
is important).

We found a way to cut it a bit by NULLing some pointers inside RSA
structure:

        RSA *key;

        key->p = NULL;
        key->q = NULL;
        key->dmp1 = NULL;
        key->dmq1 = NULL;
        key->iqmp = NULL;

and store  it in DER format:

        i2d_RSAPrivateKey(key, &bufp);

But, as you can see, it is a very hackish solution and we wonder if there
is no more standard and clean way to implement this.

How to store a rsa private key on a smartcard depends on what you want to do with the private key on the card. In case want to use a crypto card for, for example, signature generation the format of the private key is os specific. If you want to use the smartcard as a memory stick the format doesn't really matter. If you need a standard try pkcs#15, but pkcs#15 is not so easy to implement (and it creates a lot of overhead in this case).

Nils
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to