@@ -403,30 +403,39 @@ basic_SKM<RequestHandler, SignatureVerifier>::make_license_key(basic_Error & e,
403403{
404404 if (e) { return nullopt ; }
405405
406- size_t k = s.find (' -' );
407- if (k == std::string::npos) { e.set (api::main (), errors::Subsystem::Main, errors::Main::UNKNOWN_SERVER_REPLY); return nullopt ; }
406+ optional<RawLicenseKey> raw_license_key;
408407
409- std::string version = s.substr (0 , k);
410- std::string rem = s.substr (k+1 , std::string::npos);
411- // NOTE: s.substr(s.size(), _) returns empty string, thus the previous line does never throw
408+ raw_license_key =
409+ ::cryptolens_io::v20180502::internal::handle_activate (e, this ->signature_verifier, s);
412410
413- k = rem. find ( ' - ' );
414- if (k == std::string::npos) { e. set (api::main (), errors::Subsystem::Main, errors::Main::UNKNOWN_SERVER_REPLY); return nullopt ; }
411+ if (e) {
412+ e. reset (api::main ());
415413
416- std::string license = rem. substr ( 0 , k );
417- std::string signature = rem. substr (k+ 1 , std::string::npos); // k+1 is fine, see comment above
414+ size_t k = s. find ( ' - ' );
415+ if (k == std::string::npos) { e. set ( api::main (), errors::Subsystem::Main, errors::Main::UNKNOWN_SERVER_REPLY); return nullopt ; }
418416
419- optional<RawLicenseKey> x =
420- RawLicenseKey::make
421- ( e
422- , signature_verifier
423- , license
424- , signature
425- );
417+ std::string version = s.substr (0 , k);
418+ std::string rem = s.substr (k+1 , std::string::npos);
419+ // NOTE: s.substr(s.size(), _) returns empty string, thus the previous line does never throw
426420
427- optional<LicenseKeyInformation> y = LicenseKeyInformation::make (e, x);
421+ k = rem.find (' -' );
422+ if (k == std::string::npos) { e.set (api::main (), errors::Subsystem::Main, errors::Main::UNKNOWN_SERVER_REPLY); return nullopt ; }
423+
424+ std::string license = rem.substr (0 , k);
425+ std::string signature = rem.substr (k+1 , std::string::npos); // k+1 is fine, see comment above
426+
427+ raw_license_key =
428+ RawLicenseKey::make
429+ ( e
430+ , signature_verifier
431+ , license
432+ , signature
433+ );
434+ }
435+
436+ optional<LicenseKeyInformation> license_key_information = LicenseKeyInformation::make (e, raw_license_key);
428437 if (e) { e.set_call (api::main (), errors::Call::BASIC_SKM_MAKE_LICENSE_KEY); return nullopt ; }
429- return LicenseKey (std::move (*y ), std::move (*x ));
438+ return LicenseKey (std::move (*license_key_information ), std::move (*raw_license_key ));
430439}
431440
432441
0 commit comments