[Qt-interest] Adding key generation functionality to QSslKey - any ideas?

Thiago Macieira thiago at kde.org
Wed Aug 25 17:51:45 CEST 2010


Em Quarta-feira 25 Agosto 2010, às 17:23:17, Darren Lissimore escreveu:
> Hello all;
> 
> I would like to add Key generation methods to the QSslKey class to
> enable generation of keys instead of just reading them in from
> QByteArrays or QIOdevices.
> For this I would use the following OpenSSL function - and the DSA
> equivalent:
> 
>  RSA *RSA_generate_key(int num, unsigned long e,
>     void (*callback)(int,int,void *), void *cb_arg);
> 
> My problem is trying to come up with the best method to do it.
> 
> QSslKey has the handle() method - but what I need is the ability to
> set the internall  RSA * or DSA * structures within the QSslKey class.
> The OpenSSL key generation functions return a pointer to the setup RSA
> or DSA structures with the new key in it.
> I was hoping to subclass - and add the key generation methods but the
> data is private.
> 
> Ideally I would like to come up with a class that does not require a
> patch to Qt.

I would recommend a QSslKeyGenerator class, that collects the necessary input 
and produces a QSslKey as a result.

To set the result, without modifying Qt, you'd need to generate a binary 
encoding of the key and then pass to QSslKey as a byte array to be parsed 
again.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100825/54cf9ca2/attachment.bin 


More information about the Qt-interest-old mailing list