Forum Discussion
jagath_311361
Nimbostratus
Jul 26, 2018HMAC Authentication using F5
We are trying to use the below iRule, as mentioned in the link https://devcentral.f5.com/codeshare/akamai-g20-header-authentication, which apparently is not working as the CRYTO::sign returns a hash ...
Jul 27, 2018
Like you mentioned, the
CRYPTO:sign
returns a binary. You need to convert this to a hexidecimal string. The iRule below works for me.
when HTTP_REQUEST {
if {[HTTP::header exists "X-Akamai-G2O-Auth-Data"] && [HTTP::header exists "X-Akamai-G2O-Auth-Sign"]} {
set shared secret here
set secret_key "pass"
set data "[HTTP::header value "X-Akamai-G2O-Auth-Data"][HTTP::path]"
set signature "[HTTP::header value "X-Akamai-G2O-Auth-Sign"]"
set signed_data_binary [CRYPTO::sign -alg hmac-sha256 -key $secret_key $data]
binary scan $signed_data_binary H* signed_data_hex
if { $signed_data_hex eq $signature } {
log local0. "Signatures match"
}
}
}
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects