Andrew Fan wrote:
Hi,
After creating a public key pair, I'm not sure how many times it will be
used and when is must be destroied. In destroyer, I call
SECKEY_DestroyPrivateKey to release the private key. How can I do when I
reference a exist SECKEYPrivateKey and do not destroy twice? I think
there are functions like PK11_ReferenceSlot or PK11_ReferenceSymKey.
PrivateKey structures are not reference counted, IIRC. There is a
function that makes a duplicate key, which is actually a separate copy.
If you want to reference count the private key, you will need to create
your own structure or means to keep track of the ref counts.