Forum Discussion
iRule Header Insert
- Nov 29, 2022
Hi Sgnormo,
the most intuitive method would be to [string map] unwanted parts out of your certificate.
set truncated_cert [string map [list "-----BEGIN CERTIFICATE-----" "" "----END CERTIFICATE----" "" "\n" ""] $original_cert]
The more nerdy way is to read the input, skip the first 27 chars (aka. total length of -BEGIN CERTIFICATE-), and then keep the remaining char till the next occourence of "-" (aka. first char of -END CERTIFICATE-).
set truncated_cert [substr $original_cert 27 "-"]
Note: The certificate is b64 encoded, so its safe to say that the certificate itself does not contain the "-" char.
Cheers, Kai
Hi Sgnormo,
the most intuitive method would be to [string map] unwanted parts out of your certificate.
set truncated_cert [string map [list "-----BEGIN CERTIFICATE-----" "" "----END CERTIFICATE----" "" "\n" ""] $original_cert]
The more nerdy way is to read the input, skip the first 27 chars (aka. total length of -BEGIN CERTIFICATE-), and then keep the remaining char till the next occourence of "-" (aka. first char of -END CERTIFICATE-).
set truncated_cert [substr $original_cert 27 "-"]
Note: The certificate is b64 encoded, so its safe to say that the certificate itself does not contain the "-" char.
Cheers, Kai
Recent Discussions
Related Content
* 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