mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05:00
fixed crash due to writing an unsupported key type
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-OpenPGP@5218 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
043c7a8139
commit
36bec260b9
@ -357,7 +357,9 @@ std::string PGPHandler::makeRadixEncodedPGPKey(const ops_keydata_t *key)
|
||||
ops_memory_t *buf = NULL ;
|
||||
ops_setup_memory_write(&cinfo, &buf, 0);
|
||||
|
||||
ops_write_transferable_public_key(key,armoured,cinfo);
|
||||
if(ops_write_transferable_public_key(key,armoured,cinfo) != ops_true)
|
||||
return "ERROR: This key cannot be processed by RetroShare because\nDSA certificates are not yet handled." ;
|
||||
|
||||
ops_writer_close(cinfo) ;
|
||||
|
||||
std::string akey((char *)ops_memory_get_data(buf),ops_memory_get_length(buf)) ;
|
||||
|
@ -585,6 +585,12 @@ ops_boolean_t ops_write_struct_public_key(const ops_public_key_t *key,
|
||||
{
|
||||
assert(key->version == 4);
|
||||
|
||||
if(key->algorithm != OPS_PKA_RSA)
|
||||
{
|
||||
fprintf(stderr,"\nUnhandled key algorithm %d\n",key->algorithm);
|
||||
return ops_false ;
|
||||
}
|
||||
|
||||
return ops_write_ptag(OPS_PTAG_CT_PUBLIC_KEY,info)
|
||||
&& ops_write_length(1+4+1+public_key_length(key),info)
|
||||
&& write_public_key_body(key,info);
|
||||
@ -905,7 +911,11 @@ ops_boolean_t encode_m_buf(const unsigned char *M, size_t mLen,
|
||||
|
||||
// implementation of EME-PKCS1-v1_5-ENCODE, as defined in OpenPGP RFC
|
||||
|
||||
assert(pkey->algorithm == OPS_PKA_RSA);
|
||||
if(pkey->algorithm != OPS_PKA_RSA)
|
||||
{
|
||||
fprintf(stderr,"\nUnhandled key algorithm %d\n",pkey->algorithm);
|
||||
return ops_false ;
|
||||
}
|
||||
|
||||
k=BN_num_bytes(pkey->key.rsa.n);
|
||||
assert(mLen <= k-11);
|
||||
|
Loading…
Reference in New Issue
Block a user