Wiki

Clone wiki

Casino2ApiClient / Example_of_Certificate_Generation

For example: Linux, Ubuntu 12.04.4

First of all, you need to create a folder where you will store generated files for casino.

$ mkdir casino_files

Then, just go to created folder:

$ cd casino_files

List files:

$ ls -la

total 8
drwxrwxr-x 2 noname noname 4096 Jun  23 10:30 .
drwxrwxr-x 3 noname noname 4096 Jun  23 10:30 ..

After all of this you need to generate private key and certificate signing request just as we have said before on API wiki-page.

$ openssl req -out client.csr -new -newkey rsa:2048 -nodes -keyout client.key

* Attention! You should preinstall openssl component

Generating a 2048 bit RSA private key
.............................................................................+++
..............................................................................................+++
writing new private key to 'client.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) []: US
State or Province Name (full name) []: New York
Locality Name (eg, city) []: New York
Organization Name (eg, company) []: MyCompany ltd
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:casino2      
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

* You can fill most of fields with whatever you want or just leave it blank.

** The only requirement is the format of Common Name: casino123 where 123 is ID of your casino.

After executing this command, you will see new files in that folder.

$ ls -la

total 32
drwxrwxr-x  3 noname noname  4096 Jun  23 10:30 .
drwxr-xr-x 80 noname noname 12288 Jun  23 10:22 ..
-rw-rw-r--  1 noname noname   980 Jun  23 10:23 client.csr
-rw-rw-r--  1 noname noname  1704 Jun  23 10:23 client.key

Put the content of client.csr to "API Cert dialog" in your administrator's account and you will get a signed API certificate.

csr.png

Bingo! Now just copy content of the right column and put it to file client.crt. That's your certificate for our API.

And finally, you need to join (concatenate) client.key and client.crt and save it to the new file named apikey.pem. Because our API Client requires to do that.

On Linux you can do it like that:

$ cat client.key client.crt > apikey.pem

That's all, my congrats, you made your certificate for our API!

As a result you have:

$ ls -la

total 24
drwxrwxr-x 2 noname noname 4096 Jun  23 12:41 .
drwxrwxr-x 3 noname noname 4096 Jun  23 10:30 ..
-rw-rw-r-- 1 noname noname 3383 Jun  23 12:41 apikey.pem
-rw-rw-r-- 1 noname noname 1680 Jun  23 12:41 client.crt
-rw-rw-r-- 1 noname noname  980 Jun  23 12:41 client.csr
-rw-rw-r-- 1 noname noname 1704 Jun  23 12:41 client.key

For example, apikey.pem contains data something like that:

-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDlAn8S7bCzD2LR
hI2CBWs0//3cZrPdbHvIQ7djJpfyFMEv/TaRJzOPxjXbN32dsGrI0MYofj2L+JPF
aZMb6VMKfy46b2Zahwgvwiag7sYJd9KadcTGRx/lqEBuYrCeNqls8ZSuzGtcjKt7
5IITvaR2LR+AVbiHzlXdYEAecV4074FtF9f6VU4hxgSXfJe877PyAxLmdB5B5dQa
FKrr152y1xeIu9IYeGPUSLdQeqPnPbM1Oqu69491IIqps3fNjZD71dch+xid27w2
d3PUnK64qgVpWVEpcf5iSzLcx6+M/rtKcR8tEeUYgGw9o9EcY4TyXA6kKbVXx5C2
xPtoHogFAgMBAAECggEBAMcmhJtRWHheyPCq9OQ9Eh3lAD7KkV/dF0fwm2n+BeTf
Z6Dz8qAIFy7Qj8UzXGnlIafBlpFgNuWiJd9nECcVoMFgGDN47OmMw/HERRNukYlq
ShtIjvZeo75zspRL/ouXvX6gF0xrOHIjyn07GmNQZ9TdKKfR48c2CDWbnibbL7GX
cTJkZirOhoLMZOwhGauhvN3Nj5hFeFUxd9ih5opjJ4CoscURZO5pOPpvNPy750lA
XkkJeXiOzLmrOrHpEdUxFKVQ0Qi6hy0QHsdbTHj5guobsx80+rH9uJIrDm5OwNUC
/hR7a2kOEYj/67vyUuFrCNVRZ1jN65nufBTe5A1No4ECgYEA9COVA6s8qNn5vkKc
tK2TqI0rBIh7AmB0ycP/9L3/8xL28z1j3b+AxkBurpstaJK0mdSsGXLblUzYqDpz
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