# 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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yubico.gitbook.io/yubikey5/piv-1/slots/9a/certreq.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
