I am currently trying to convert from OpenSSL to NSS (seemed like a good 
idea at the time).   The code that I currently have an issue with is 
essentially ...

  key=RSA_new();
  if (key) {
    key->n=BN_bin2bn(IssPubKey,IssPubKeyLgth,NULL);
    key->e=BN_bin2bn(PubKeyExponent->value,PubKeyExponent->lgth,NULL);
    decrypt_lgth=RSA_public_decrypt(lgth, value, (unsigned char 
*)recovered, key, RSA_NO_PADDING);
  }
  RSA_free(key);


but the key is a public key. 


I originally though that function PK11_PubDecryptRaw would provide the 
same outcome (having encoded and imported the key - see NSS tech note #7) 
but now realise that it only uses a private key (the normal way of doing 
things) and cannot be used with a public key.  I cannot find any other 
function that will do this - so, is there a function that I haven't 
spotted yet or am I completely wrong with this approach? !


Any help or ideas greatly appreciated.

-- Alan Morris
   The Logic Group
   Tel:  +44 (0)1252 644021


The Logic Group Enterprises Limited
Logic House, Waterfront Business Park, Fleet Road, Fleet, Hampshire, GU51 3SB, 
UK
Registered in England. Registered No. 2609323
_______________________________________________
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to