function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
hermitagehermitage 

Base 64

Hi,

Can we use Base64 directly in our class for encoding a certification file. If possible can you please tell me how.

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
gtindugtindu

You need to use the base64Encode / base64Decode methods for the EnodingUtil class that Simon linked to.  That enables you to base64 encode/decode data within your Apex code.

All Answers

hermitagehermitage

Thanks SImon,

But what i am trying to do is i am calling a http req and while setting the client certificate, i am using base 64 encoder from an external website and copying it here. Now my Req is to directly encode it here instead of going to other website.

 

Httprequest req = new httpRequest();

 

req.setcertificate('...................encoded data from external website..,)

gtindugtindu

You need to use the base64Encode / base64Decode methods for the EnodingUtil class that Simon linked to.  That enables you to base64 encode/decode data within your Apex code.

This was selected as the best answer