src/algorithm/hmacsha.cpp
/**
			 * Check if signature is valid
			 * @param data The data to check signature against
			 * @param signature Signature provided by the jwt
			 * @throws signature_verification_exception If the provided signature does not match
			 */
Check if signature is valid
@param data The data to check signature against
@param signature Signature provided by the jwt
@throws signature_verification_exception If the provided signature does not match
Check if signature is valid @param data The data to check signature against @param signature Signature provided by the jwt @throws signature_verification_exception If the provided signature does not match
void hmacsha::verify(const std::string& data, const std::string& signature) const 
			{
				try {
					auto res = sign(data);
					bool matched = true;
					for (size_t idx = 0; idx < std::min<size_t>(res.size(), signature.size()); ++idx) {
						if (res[idx] != signature[idx]) {
							matched = false;
						}
					}
					if (res.size() != signature.size()) {
						matched = false;
					}
					if (!matched)
						throw "signature_verification_exception()";
				}
				catch (const std::string& s) {
					throw s;
				}
			}
void hmacsha :: verify ( const std :: string & data , const std :: string & signature ) const { try { auto res = sign ( data ) ; bool matched = true ; for ( size_t idx = 0 ; idx < std :: min < size_t > ( res . size ( ) , signature . size ( ) ) ; ++ idx ) { if ( res [ idx ] != signature [ idx ] ) { matched = false ; } } if ( res . size ( ) != signature . size ( ) ) { matched = false ; } if ( ! matched ) throw " " ; } catch ( const std :: string & s ) { throw s ; } }
Check if signature is valid
 @param data The data to check signature against
 @param signature Signature provided by the jwt
 @throws signature_verification_exception If the provided signature does not match
Check if signature is valid @param data The data to check signature against @param signature Signature provided by the jwt @throws signature_verification_exception If the provided signature does not match
//throw signature_verification_exception(); //catch (const signature_generation_exception&) { //	throw signature_verification_exception(); //}