MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / evlRsaPublic

Function evlRsaPublic

src/jrd/SysFunction.cpp:3883–3909  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3881}
3882
3883dsc* evlRsaPublic(thread_db* tdbb, const SysFunction* function, const NestValueArray& args, impure_value* impure)
3884{
3885 tomcryptInitializer();
3886
3887 fb_assert(args.getCount() == 1);
3888
3889 Request* request = tdbb->getRequest();
3890
3891 const dsc* value = EVL_expr(tdbb, request, args[0]);
3892 if (request->req_flags & req_null) // return NULL if value is NULL
3893 return NULL;
3894
3895 DscValue data(tdbb, value, "private key");
3896 rsa_key rsaKey;
3897 tomCheck(rsa_import(data.getBytes(), data.getLength(), &rsaKey), Arg::Gds(isc_tom_rsa_import));
3898
3899 unsigned long outlen = data.getLength();
3900 UCharBuffer key;
3901 int cryptRc = rsa_export(key.getBuffer(outlen), &outlen, PK_PUBLIC, &rsaKey);
3902 rsa_free(&rsaKey);
3903 tomCheck(cryptRc, Arg::Gds(isc_tom_rsa_export) << "public");
3904
3905 dsc result;
3906 result.makeText(outlen, ttype_binary, key.begin());
3907 EVL_make_value(tdbb, &result, impure);
3908 return &impure->vlu_desc;
3909}
3910
3911
3912int getMaxSaltlen(int hashIdx, rsa_key* key)

Callers

nothing calls this directly

Calls 14

EVL_exprFunction · 0.85
rsa_importFunction · 0.85
GdsClass · 0.85
rsa_exportFunction · 0.85
rsa_freeFunction · 0.85
EVL_make_valueFunction · 0.85
makeTextMethod · 0.80
tomCheckFunction · 0.70
getCountMethod · 0.45
getRequestMethod · 0.45
getBytesMethod · 0.45
getLengthMethod · 0.45

Tested by

no test coverage detected