Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

iRule Header Insert

sgnormo
Cirrus
Cirrus

I have a F5 setup for C3D (working), but the customer states they also need the original user certificate, so added an iRule to insert the whole user certificate doing the header insert.

Customer has come back and said that need the certificate without the "-----BEGIN CERTIFICATE----- ----END CERTIFICATE----" 

Is that possible?

 

1 ACCEPTED SOLUTION

Kai_Wilke
MVP
MVP

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 


iRule can do… 😉

View solution in original post

1 REPLY 1

Kai_Wilke
MVP
MVP

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 


iRule can do… 😉