NZzi wrote:
NZzi wrote:

hi all:

I want to use private key to encrypt a message,
and decrypt with public key.

i know there is PK11_PubDecryptRaw, PK11_PubEncrptRaw,
but all these don't do padding things(PKCS1) for
me.

and SGN_*(), VFY_*(), PK11_Verify*() give me the
digest message, not plaint message i want.

i find PK11_PubEncryptPKCS1() in mailing list
discussion, which seems to do the padding. But
i want to use private key to encrypt, not
public key. And what's more, there are not any
doc or example codes to show PK11_PubEncryptPKCS1()
usage


because i use PK11_PubEncryptPKCS1() in my code guessing
howto use, but i got 8192 error(PR_GetError()), i lookup
the error code:

An I/O error occurred during authentication; or
an error occurred during crypto operation (other than signature verification).

all the description is senseless for me


following is my code:

modulus_len = modulus_len = SECKEY_PublicKeyStrength(lf_sec->pubkey);
char *data_buf = calloc(...modulus_len);
char *enbuf = calloc(...,modulus_len);

PK11_PubEncryptPKCS1(lf_sec->pubkey,enbuf,tmpbuf,modulus_len,NULL);
...

use the same parameters for PK11_PubEncryptRaw() will work well





can anyone give me some examples or hints? thanks
in advance





_______________________________________________
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to