On Sun, 9 Sep 2012 12:43:19 -0700 (PDT) Seba Seba <[email protected]> wrote:
> Hi all, > > Im new to cypto++, i've been reading the docs about generating RSA > keys, but couldnt find anything related with the keyinfo. > If i got it right, RSA::PrivateKey holds both the key material or key > bits, as well as the keyInfo that holds the algorithm, user/owner > name, email, country and all that information. > > I'd like to know how to generate a key and add this particular > information. My goal is to generate keys for users, store them on a > database (encrypted with the user passphrase) and be able to share > public keys, just like GnuPG does. > What are the extra steps that i should add to the "generate, save and > load" examples, in order to add the user info and store those keys > safely? > > thanks a lot in advance! > As far as I’m aware, the furthest you can go with Crypto++’s built-in functionality is to a SubjectPublicKeyInfo structure. This doesn’t contain anything about humans; it’s just a wrapper around a key that contains enough data to use the key algorithmically (things like DH parameters, elliptic curve choices, or whatever if needed, plus an indication of what type of key is contained). The kind of structure you’re looking for is called a certificate; there are a handful of formats for certificates, the most common are X.509 (most often used by TLS-equipped network servers but also usable for client authentication and e-mail signing/encryption) and OpenPGP (most often used for e-mail signing/encryption). There’s an example of getting the key out of an X.509 certificate on the wiki at <http://www.cryptopp.com/wiki/X.509>; as you can see, the example code parses the certificate structure directly because Crypto++ doesn’t have built-ins for that job (the way many other libraries like OpenSSL do). Chris -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com.
