---
title: Public Certificate Creation using win-acme (Optional)
slug: public-certificate-creation-using-win-acme-optional
docTags: 
createdAt: 2023-05-29T21:54:48.000Z
---

In order to authenticate using a certificate, both a public and a private key are required. The following steps outline how to generate a keystore on the server using Win-ACME and later use KeyStore Explorer to manage the public and private keys. <u>**This step is optional if the client already has a trusted certificate issued by a recognized Certificate Authority (CA).&#x20;**</u>

Download win-acme from official website ([https://www.win-acme.com/](https://www.win-acme.com/))

The downloaded file should be in ZIP format. Hence, extract the contents of the file and place them in the middleware server, e.g., c:/wacs

now open command prompt as administrator and navigate to folder location c:\wacs

execute wacs.exe

choose "M" from menu.

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/7-YOVbXMg-f1Zi_UP-Wci_image.png)

type 2 to manually entered all the domain.

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/hoE9MVarwJSEER6QbdUW9_image.png)

Now provide DSN name. you can enter multiple seprated by ,.

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/2L-1L7nh4KqZSMdXpLx8__image.png)

The next prompt will ask for the friendly name of the generated certificate. Enter suitable name


![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/LtHhmCoVDuYavNlyfBzPE_image.png)

Type 4 to generate a single certificate.

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/WCsM8k9aLX0nNK8800SPq_image.png)

Type 2 for "Serve verification files from memory"



![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/m4f0wKlbv9i_LE-6LSXHK_image.png)

Type 2 for RSA Key.

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/EoWr3Th10l-rTolELPY9l_image.png)

Type 3 to generate PFX archive

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/Zy4wKqon4aJvZdB75Js1Q_image.png)

Next provide desired folder path where pfx file will be saved.



![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/ydWW0VGauJSixzIKYh0ln_image.png)

Next 1 to not associate a password or 2 to protect pfx with password. Here I will choose 1.

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/y4FOPE7PwAJdrfszEiENf_image.png)

Now select 5 for No additional store steps.

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/VMS9EK9KD_WL_vuSpwO3K_image.png)

Type 3 for No Addtional installation steps.

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/TAT358dF56UsvVCwHfyfJ_image.png)

Now it will run generate pfx file in desired location.


![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/-x4u0QXEx9qWJqQrlnH9D_image.png)

Press Q to Quit.

Now, the PFX file has been generated. It is time to extract the public and private keys from it. To achieve this, we will use a tool called 'KeyStore Explorer'. It can be downloaded from this link : ([https://keystore-explorer.org/downloads.html](https://keystore-explorer.org/downloads.html))

Once downloaded, install it with the default settings&#x20;

open KeyStore Explorer.

Drag and drop the newly generated PFX file onto the KeyStore Explorer window, or choose to open an existing keystore.&#x20;

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/8lMT6H4FIhbmdHIi-9oSt_image.png)

Enter the password if provided at the time of PFX creation; otherwise, press Enter or click OK. You should be able to see the certificate chain details with the DNS name.

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/bH97IWlsIea78duyX-l_6_image.png)

Right-click on the certificate chain, select 'Export' → 'Export Private Key' to export the private key.&#x20;

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/7DEPo_vBPmo8VwC4prOBf_image.png)

For the password, enter the password you provided earlier, or press Enter or click OK.&#x20;

Select 'PCS#8' for the private key export type and click OK.&#x20;

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/HxrHvfCJZhOpjpFDx_Mnf_image.png)

Next, it will provide an option to encrypt and specify the export file location. For this, we will use an unencrypted private key.

Uncheck 'Encrypt.'

In the 'Export File' field, change the folder location and file name.

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/9KS6sHUCYfK6zbiczV1Oh_image.png)

Click 'Export,' and a success message should appear.&#x20;

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/ZxctDhwrvWwGf1YIQY1Ar_image.png)

Now, generate the public certificate by right-clicking, selecting 'Export' → 'Export Certificate Chain.'&#x20;

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/9r_RTwADwhNLFLRQiwYv0_image.png)

Next, select 'Entire Chain' in the Export Length, 'X.509' in the Export Format, and change the folder location and file name in the 'Export File' field.&#x20;

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/NRq6yv0Sf5jOx9m4SoASq_image.png)

Click on 'Export,' and a success message should appear.&#x20;

![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/x4HYOr0ZRTI0jlk6EcZ8e_image.png)

Now, go to the folder location, and there should be two files exported.&#x20;


![](https://api.archbee.com/api/optimize/1hH4CNQG9tP4YS-TB-TC6/hkNb0nekNbzLu4ij1iwpw_image.png)

The PEM file represents the private key, and the CER file is the public certificate.&#x20;

The next step is to place those files under the config folder of the Middleware installation and modify the init file:

- 'sharepoint.cert.privatekey.path' to the private key path
- 'sharepoint.cert.publickey.path' to the public certificate path
- 'sharepoint.cert.privatekey.encrypted' to 'Yes' or 'No' if the private key is encrypted
- 'sharepoint.cert.privatekey.password' to the decrypted private key password via the Encryption utility

For more details, please refer to the 'SharePoint M365 Endpoint' section."





# SharePoint (SP365) Cert Authentication Configuration Example

Authentication Modes

App-Based Authentication
&#x20;Enables service-to-service communication without user interaction.
&#x20;sp365.sharepoint.appBasedAuthentication = true

Certificate-Based Authentication
&#x20;Uses certificates for enhanced security.
&#x20;sp365.sharepoint.certBasedAuthentication = true

## OAuth 2.0 Parameters

Grant Type
&#x20;sp365.sharepoint.granttype = client\_credentials

Client Assertion Type
&#x20;sp365.sharepoint.client.assertion.type = urn\:ietf\:params\:oauth\:client-assertion-type\:jwt-bearer

Resource URL
&#x20;sp365.sharepoint.resource.url = https\://graph.microsoft.com

## Certificate Configuration

Private Key Path
&#x20;Path to the private key file used to sign JWTs.
&#x20;sp365.sharepoint.cert.privatekey.path = \<path-to-private-key.pem>

Private Key Encryption
&#x20;Indicates whether the private key file is encrypted.
&#x20;sp365.sharepoint.cert.privatekey.encrypted = YES

Private Key Password (use encryption utility)
&#x20;Provide only if encryption is enabled.
&#x20;sp365.sharepoint.cert.privatekey.password = \<secure-password>

Public Key Path
&#x20;Path to the public certificate used to validate signatures.
&#x20;sp365.sharepoint.cert.publickey.path = \<path-to-public-cert.cer>

## JWT Settings

Type
&#x20;sp365.sharepoint.jwt.type = JWT

Algorithm
&#x20;sp365.sharepoint.jwt.algorithm = RS256

Expiration
&#x20;Example: 1 hour = 3600000 ms
&#x20;sp365.sharepoint.jwt.expiration.millisec = 3600000
