# Create and Apply SSL Certificate to Aria2 RPC Interface

## Prerequisites

- A XCA PKI database https://youtu.be/ezzj3x207lQ

## Create Your SSL Certificate

1. Launch XCA
2. Open the PKI database if it is not already (File > Open DataBase), enter password
3. Click on the Certificates tab, right click on your Intermediate CA certificate
4. Select New
5. On the Source tab, make sure Use this Certificate for signing is selected
6. Verify your Intermediate CA certificate is selected from the drop down
7. Click the Subject tab
8. Complete the Distinguished Name section

   internalName: aria2.i12bretro.local
   countryName: US
   stateOrProvinceName: Virginia
   localityName: Northern
   organizationName: i12bretro
   organizationUnitName: i12bretro Certificate Authority
   commonName: aria2.i12bretro.local

9. Click the Generate a New Key button
10. Enter a name and set the key size to at least 2048
11. Click Create
12. Click on the Extensions tab
13. Select End Entity from the type list
14. Click Edit next to Subject Alternative Name
15. Add any DNS or IP addresses that the certificate will identify
16. Update the validity dates to fit your needs
17. Click the Key Usage tab
18. Under Key Usage select Digital Signature, Key Encipherment
19. Under Extended Key Usage select Web Server and Web Client Authentication
20. Click the Netscape tab
21. Select SSL Server
22. Click OK to create the certificate

## Exporting Required Files

1. In XCA, click on the Certificates tab
2. Right click the SSL certificate > Export > File
3. Set the file name to aria2.p12 and verify the export format is PKCS#12 chain (*.p12)
4. Click OK
5. Leave the passwords blank > Click OK

## Applying SSL Certificates

1. Move the exported .p12 file to the aria2 installation directory
2. Open aria2.conf in a text editor
3. Add the following lines to the .conf file, updating the file path if aria2 is installed to a different location

   rpc-certificate=c:\Program Files\aria2\aria2.p12
   rpc-secure=true

4. Save the changes to aria2.conf
5. Kill aria2c.exe if it is currently running
6. Relaunch aria2c either via command line or scheduled task
7. Load your aria2 web UI of choice
8. Update the RPC connection to enable SSL