| 3881 | } |
| 3882 | |
| 3883 | dsc* 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 | |
| 3912 | int getMaxSaltlen(int hashIdx, rsa_key* key) |
nothing calls this directly
no test coverage detected