base64Decode not working to decode CSR

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2022 11:09 PM
Hello,
I'm trying to decode a CSR (e.g. https://www.digicert.com/order/sample-csr.php) thanks to the GlideStringUtil.base64Decode function, but the result is not the one expected.
Here is the background script I'm executing, based on a record where I put the CSR sample:
var gr = new GlideRecord('sn_disco_certmgmt_certificate_task');
gr.get('00d208fc871381507f9362c73cbb35ea')
gs.print(GlideStringUtil.base64Decode(gr.csr)) ;
But the output of the function is not readable (see below)
Could you please tell me what I'm doing wrong or if I should perform this activity differently ?
Best regards,
Julien
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2022 01:05 AM
So you have a field which holds base64encoded data?
you want to decode and do what with that?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2022 01:47 AM
Hi Ankur,
I want to extract data from it, like this site https://certlogik.com/decoder/ does, and show the attributes of the CSR to the end user who wants to submit it to DigiCert to get it signed. Showing the details will help him confirm it's the right CSR and also I'll be able to check if the encryption key is 4096 and not 2048 for instance.
Again, I don't know if I use the right approach. If not please let me know how I could achieve this.
Best regards,
Julien
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2022 02:19 AM
Hi,
but usually base64 encoding is done for files
Consider if the base64encoded data is for word file; then what will you show to the user
We usually decoded the data and add that content in file
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2022 09:12 PM
Hi
I don't see the point regarding the word file, but if base64...code functions work for Word files, shouldn't they work for CSR ?
Is there really no way decoding a base64 encrypted CSR ?
Best regards,
Julien
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2022 09:17 PM
Hi,
Not much aware on that
regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader