Forum Discussion
7 character extraction from string (Cert subject)
I'm working a solution for an PKI requirement and I need to extract seven alphanumeric characters from the end of a cert subject. An example subject would be:
SUBJECT: C=BLAH, O=Barf, OU=Help, OU=People, Lastname Firstname MI xxxxxxx
I want to grab xxxxxxx to place into a variable. Note that not everyone will have a middle initial, but all will have xxxxxxx at the end of their x509 subject. xxxxxxx will always be a mix of lowercase alpha/0-9 numeric.
Thanks...
- Faruk_AYDIN
Nimbostratus
if the last blank is always before the 7 Chars use the following simple irule line :
set last7Chars [string last " " [X509::subject [SSL::cert 0] end]
Otherwise:
set certSubject [X509::subject [SSL::cert 0]] set lenSubject [string length $certSubject] set last7Location [expr {$lenSubject - 8}] set last7Chars [substr $certSubject $last7Location 7]
- eric_haupt1
Nimbostratus
Thank you.. I will investigate these options.
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