> For the complete documentation index, see [llms.txt](https://yubico.gitbook.io/yubikey5/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yubico.gitbook.io/yubikey5/piv-1/slots/9a/certreq.md).

# Certreq

Create a new file on your computer and name it <mark style="color:red;">**`cert_ssh_9a.txt`**</mark>

```properties
[NewRequest]
Subject = "CN=Your Name (Auth), OU=Organizational Unit, O=Organization, C=US"
KeyLength = 2048
HashAlgorithm = Sha256
Exportable = TRUE
FriendlyName = "Your Name (PIV)"
RequestType = Cert
SMIME = FALSE
ValidityPeriodUnits = 99
ValidityPeriod = Years
```

Open <mark style="color:red;">**`Command Prompt`**</mark>, <mark style="color:red;">**`Powershell`**</mark>, <mark style="color:red;">**`Terminal`**</mark> and navigate to the folder where you created <mark style="color:red;">**`cert_ssh_9a.txt`**</mark> file and execute the following:

```powershell
certreq -new .\cert_ssh_9a.txt
```

Save the <mark style="color:red;">**`.req`**</mark> file to the same folder as the newly created <mark style="color:red;">**`.txt`**</mark> file.

Next, we need to <mark style="color:red;">**`Export`**</mark> the certificate's private key.

* Open the Windows start menu and type: <mark style="color:red;">**`Manage user certificates`**</mark><mark style="color:red;">**&#x20;**</mark><mark style="color:red;">**-**</mark><mark style="color:red;">**&#x20;**</mark><mark style="color:red;">**`(certmgr.exe)`**</mark>
* Click to open the certificate manager program
* Browse to: <mark style="color:red;">**`Certificates`**</mark> – <mark style="color:red;">**`Current User`**</mark> -> <mark style="color:red;">**`Personal`**</mark> -> <mark style="color:red;">**`Certificates`**</mark>
* There you will see a certificate with the name you specified earlier
* Right-click and select: <mark style="color:red;">**`All Tasks`**</mark> -> <mark style="color:red;">**`Export`**</mark>
* Click <mark style="color:red;">**`Next`**</mark>, then select <mark style="color:red;">**Yes, export the private key**</mark>, then click <mark style="color:red;">**Next**</mark> again
* Click <mark style="color:red;">**`Next`**</mark>, then check the <mark style="color:red;">**Password:**</mark> box, and enter a password for the certificate
* Click <mark style="color:red;">**`Next`**</mark>, then <mark style="color:red;">**Browse…**</mark> and save the file as <mark style="color:red;">**`username_piv_crtsrc.pfx`**</mark>, then click <mark style="color:red;">**`Next`**</mark>, and finally <mark style="color:red;">**`Finish`**</mark>
