Forum Discussion
ahmad_2312
Nimbostratus
Feb 03, 2010Remove whiteSpace from the Certificate
Dears
we need to send the client certificate to our back-end server for authentication, but the server is expecting the certficate as the following (without whitespace)
MIIDmTCCAwKgAwIBAgIBCDANBgkqhkiG9w0BAQQFADBtMQswCQYDVQQGEwJTQTEPMA0GA1UECBMGUml5YWRoMQ8wDQYDVQQHEwZSaXlhZGgxEDAOBgNVBAoTB1Rlc3RpbmcxEDAOBgNVBAsTB1Rlc3RpbmcxGDAWBgNVBAMTD0dPU0kgVGVzdGluZyBDQTAeFw0xMDAxMTkxMzIyNTVaFw0xMTAxMTkxMzIyNTVaMHsxCzAJBgNVBAYTAlNBMRQwEgYDVQQIEwtSaXlhZGgydGVzdDEUMBIGA1UEBxMLUml5YWRoMnRlc3QxFDASBgNVBAoTC1JpeWFkaDJ0ZXN0MRQwEgYDVQQLEwtSaXlhZGgydGVzdDEUMBIGA1UEAxMLUml5YWRoMnRlc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALYEUyZj18Kd1Ec4jhlKtJp+nPyXEuKmFnibdGpGdQNhwPbmzlRIs3VdTaYGlYS3SaTRemxr20qGSxQjH2S0BKLNFfXh2c/bugob2gwLuit/Ihec1KPh5UIqdAgH/dA7cKAZnjMH2Wpl
while the F5 is sending the following:
MIIDmTCCAwKgAwIBAgIBCDANBgkqhkiG9w0BAQQFADBtMQswCQYDVQQGEwJTQTEP
MA0GA1UECBMGUml5YWRoMQ8wDQYDVQQHEwZSaXlhZGgxEDAOBgNVBAoTB1Rlc3Rp
bmcxEDAOBgNVBAsTB1Rlc3RpbmcxGDAWBgNVBAMTD0dPU0kgVGVzdGluZyBDQTAe
Fw0xMDAxMTkxMzIyNTVaFw0xMTAxMTkxMzIyNTVaMHsxCzAJBgNVBAYTAlNBMRQw
EgYDVQQIEwtSaXlhZGgydGVzdDEUMBIGA1UEBxMLUml5YWRoMnRlc3QxFDASBgNV
BAoTC1JpeWFkaDJ0ZXN0MRQwEgYDVQQLEwtSaXlhZGgydGVzdDEUMBIGA1UEAxML
Uml5YWRoMnRlc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALYEUyZj18Kd
1Ec4jhlKtJp+nPyXEuKmFnibdGpGdQNhwPbmzlRIs3VdTaYGlYS3SaTRemxr20qG
SxQjH2S0BKLNFfXh2c/bugob2gwLuit/Ihec1KPh5UIqdAgH/dA7cKAZnjMH2Wpl
i have tried many functions to do that but the space is still there
Loop through each cert and log the cert subject, issuer and serial number
for {set i 0} {$i < [SSL::cert count]} {incr i}{
log local0. "[IP::client_addr]:[TCP::client_port]: cert $i; subject=[X509::subject [SSL::cert $i]]; [X509::issuer [SSL::cert $i]]; cert_serial=[X509::serial_number [SSL::cert $i]]; [X509::hash [SSL::cert $i]];"
set allcert "[X509::whole [SSL::cert $i]]"
log local0. "[IP::client_addr]:[TCP::client_port]"
log local0. $allcert
set thecert [findstr [X509::whole [SSL::cert $i]] "-----BEGIN CERTIFICATE-----" 28 "-----END CERTIFICATE-----"]
log local0. $thecert
set certnospace [string map -nocase {" " ""} $thecert]
log local0. "Test1 $certnospace"
regsub -all " " $thecert "" certnospace2
log local0. "Test2 $certnospace2"
}
Any Help
- hoolio
Cirrostratus
Hi ahmad, - ahmad_2312
Nimbostratus
Thanx holio - ahmad_2312
Nimbostratus
Both log lines and service receives are showing the spaces - Kevin_Stewart
Employee
Ahmad,set cert [b64encode [X509::whole [SSL::cert 0]]]
- ahmad_2312
Nimbostratus
yes, i am very sure that this is what we need, even i tested that by bypass the cert as the following and it worked out and processed correctly by our weblogic back-end servers : Note that: - hoolio
Cirrostratus
Hi Ahmad, - ahmad_2312
Nimbostratus
Hi; - hoolio
Cirrostratus
Sorry, I should have noticed this before. It's probably carriage return and/or line feeds--not spaces--in the cert string. Can you try using string map to remove the whitespace? - ahmad_2312
Nimbostratus
Aaron You Are a Genius, you are right , it worked - Navin_65857
Nimbostratus
Hi , can you please let me know fix, I am still getting space
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