> What did you find ? I was about to answer you that the only way I know
> of is to use some include files of NSS that are supposed not to be
> exported, and fill the key structure by hand.
Using this code:
PK11SlotInfo * slot = PK11_GetBestSlot(CKM_RSA_PKCS, NULL);
if(slot == NULL) {
//error
}
PRArenaPool * arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
if(arena == NULL) {
//error
}
m_pubkey = (SECKEYPublicKey*)PORT_ArenaZAlloc(arena,
sizeof(SECKEYPublicKey));
if(m_pubkey == NULL ) {
//error
}
m_pubkey->arena = arena;
m_pubkey->keyType = rsaKey;
SECStatus s = SECITEM_CopyItem(NULL, &(m_pubkey->u.rsa.modulus), m_modulus);
if (s != SECSuccess)
{
//error
}
s = SECITEM_CopyItem(NULL, &(m_pubkey->u.rsa.publicExponent), m_exponent);
if (s != SECSuccess)
{
//error
}
Where m_modulus and m_exponent are SECItem structures.
Works fine now.
> NSS can only import private key if they are encrypted, which makes any
> other solution using the public API hard to use.
My question was about public key, not private.
_______________________________________________
mozilla-crypto mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-crypto