NewGen Samsung AC Protocol

Hi, picking up the discussion from: https://github.com/openhab/openhab1-addons/issues/2863#issuecomment-323180263.

This is all about figuring out the local, token based protocol to manage newer Samsung AC devices.

1 Like

OK – more progress.
Here are the commands I have working (with the exception of Wind Direction):

1 Like

Switching subjects…We now have the AC providing a token, providing status (on request) and accepting commands.
The next trick is to receive events from the AC when, for example, a user changes state with the physical remote control.
The AC sends a flurry of statements to amazon cloud services directly after its status changes.
Small example:

So, we don’t actually need to know what’s in the packet, as we can just query the device, but somehow we need to be able to know when this communication has happened, and that is our event, to query the AC.

Need some stronger brains to help with this bit!

Meanwhile the binding is in progress, I made a shell script to controll my Samsung Air Conditioner (new version with port 8888) This is added as Exec binding:

root@raspberrypi:/usr/share/openhab2/samsungac# cat control_samsungac.sh
#!/bin/sh

arg="$1"
arg2=$2

case "$arg" in

    power|Power|POWER)
        if [ $arg2 = "on" ] || [ $arg2 = "On" ] || [ $arg2 = "ON" ] ; then
        curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure -X PUT -d '{"Operation" : {"power" : "On"}}' https://192.168.1.36:8888/devices/0
        fi
        if [ $arg2 = "off" ] || [ $arg2 = "Off" ] || [ $arg2 = "OFF" ] ; then
        curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure -X PUT -d '{"Operation" : {"power" : "Off"}}' https://192.168.1.36:8888/devices/0
        fi
        ;;
    temperature|Temperature|TEMPERATURE)
        if [ $arg2 = "20" ] ; then
        curl -s -X PUT -d '{"desired": 20}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/temperatures/0
        fi
        if [ $arg2 = "21" ] ; then
        curl -s -X PUT -d '{"desired": 21}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/temperatures/0
        fi
        if [ $arg2 = "22" ] ; then
        curl -s -X PUT -d '{"desired": 22}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/temperatures/0
        fi
        if [ $arg2 = "23" ] ; then
        curl -s -X PUT -d '{"desired": 23}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/temperatures/0
        fi
        if [ $arg2 = "24" ] ; then
        curl -s -X PUT -d '{"desired": 24}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/temperatures/0
        fi
        if [ $arg2 = "25" ] ; then
        curl -s -X PUT -d '{"desired": 25}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/temperatures/0
        fi
        if [ $arg2 = "26" ] ; then
        curl -s -X PUT -d '{"desired": 26}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/temperatures/0
        fi
        if [ $arg2 = "27" ] ; then
        curl -s -X PUT -d '{"desired": 27}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/temperatures/0
        fi
        if [ $arg2 = "28" ] ; then
        curl -s -X PUT -d '{"desired": 28}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/temperatures/0
        fi
        if [ $arg2 = "29" ] ; then
        curl -s -X PUT -d '{"desired": 29}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/temperatures/0
        fi
        if [ $arg2 = "30" ] ; then
        curl -s -X PUT -d '{"desired": 30}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/temperatures/0
        fi
        ;;
        mode|Mode|MODE)
        if [ $arg2 = "cool" ] || [ $arg2 = "Cool" ] || [ $arg2 = "COOL" ] ; then
        curl -s -X PUT -d '{"modes": ["Cool"]}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/mode
        fi
        if [ $arg2 = "dry" ] || [ $arg2 = "Dry" ] || [ $arg2 = "DRY" ] ; then
        curl -s -X PUT -d '{"modes": ["Dry"]}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/mode
        fi
        if [ $arg2 = "wind" ] || [ $arg2 = "Wind" ] || [ $arg2 = "WIND" ] ; then
        curl -s -X PUT -d '{"modes": ["Wind"]}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/mode
        fi
        if [ $arg2 = "auto" ] || [ $arg2 = "Auto" ] || [ $arg2 = "AUTO" ] ; then
        curl -s -X PUT -d '{"modes": ["Auto"]}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/mode
        fi
        if [ $arg2 = "heat" ] || [ $arg2 = "Heat" ] || [ $arg2 = "HEAT" ] ; then
        curl -s -X PUT -d '{"modes": ["Heat"]}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/mode
        fi
        ;;
        purify|Purify|Purify)
        if [ $arg2 = "on" ] || [ $arg2 = "On" ] || [ $arg2 = "ON" ] ; then
        curl -s -X PUT -d '{"options": ["Spi_On"]}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/mode
        fi
        if [ $arg2 = "off" ] || [ $arg2 = "Off" ] || [ $arg2 = "OFF" ] ; then
        curl -s -X PUT -d '{"options": ["Spi_Off"]}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/mode
        fi
        ;;
        goodsleep|Goodsleep|GOODSLEEP)
        if [ $arg2 = "1" ] ; then
        curl -s -X PUT -d '{"options": ["Sleep_2"]}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/mode
        fi
        if [ $arg2 = "2" ] ; then
        curl -s -X PUT -d '{"options": ["Sleep_4"]}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/mode
        fi
        if [ $arg2 = "3" ] ; then
        curl -s -X PUT -d '{"options": ["Sleep_6"]}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/mode
        fi
        if [ $arg2 = "4" ] ; then
        curl -s -X PUT -d '{"options": ["Sleep_8"]}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/mode
        fi
        if [ $arg2 = "5" ] ; then
        curl -s -X PUT -d '{"options": ["Sleep_10"]}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/mode
        fi
        if [ $arg2 = "6" ] ; then
        curl -s -X PUT -d '{"options": ["Sleep_12"]}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/mode
        fi
        if [ $arg2 = "7" ] ; then
        curl -s -X PUT -d '{"options": ["Sleep_14"]}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/mode
        fi
        if [ $arg2 = "8" ] ; then
        curl -s -X PUT -d '{"options": ["Sleep_16"]}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/mode
        fi
        if [ $arg2 = "9" ] ; then
        curl -s -X PUT -d '{"options": ["Sleep_18"]}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/mode
        fi
        if [ $arg2 = "10" ] ; then
        curl -s -X PUT -d '{"options": ["Sleep_20"]}' -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure https://192.168.1.36:8888/devices/0/mode
        fi
        ;;
esac

sleep 5

curl -s -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "status" "http://localhost:8080/rest/items/SamsungAC_Input"

power=`curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure -X GET https://192.168.1.36:8888/devices|jq '.Devices[0].Operation.power'`
mode=`curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure -X GET https://192.168.1.36:8888/devices|jq '.Devices[0].Mode.modes[0]'`
purify=`curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure -X GET https://192.168.1.36:8888/devices|jq '.Devices[0].Mode.options[3]'`
goodsleep=`curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure -X GET https://192.168.1.36:8888/devices|jq '.Devices[0].Mode.options[1]'`
temperature=`curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure -X GET https://192.168.1.36:8888/devices|jq '.Devices[0].Temperatures[0].current'`
desired=`curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer r42iV2EQ1c" --cert /etc/openhab2/services/cert.pem --insecure -X GET https://192.168.1.36:8888/devices|jq '.Devices[0].Temperatures[0].desired'`

echo "Power: $power";
echo "Mode: $mode";
echo "Purify: $purify";
echo "Temperature: $temperature°C";
echo "Desired: $desired°C";
echo "Good sleep: $goodsleep";
root@raspberrypi:/usr/share/openhab2/samsungac#

Rules example:

rule "Samsung AC night"
when
                                Time cron "0 0 23 ? * MON-SUN"
then
        sendCommand(SamsungAC_Input, "power on")
        Thread::sleep(5000)
        sendCommand(SamsungAC_Input, "temperature 24")
        Thread::sleep(5000)
        sendCommand(SamsungAC_Input, "purify on")
        Thread::sleep(5000)
        sendCommand(SamsungAC_Input, "goodsleep 2")
end

Of course you can another IP address, another path to cert file, and another token key (mine is r42iV2EQ1c)

Thank you all the hard working on this project!

1 Like

Hello!

I was following your thread previously and I got towards the end with your python scripts but they were never posted.

I want to communicate with a different device and I’m stuck on the devicetoken request:

import requests
s = requests.Session()
headers = {‘Host’: ‘192.168.1.151:8889’, ‘X-API-Version’: ‘v1.0.0’}

resp = s.post(“https://192.168.1.181:8888/devicetoken/request”, headers=headers, stream=True, verify=False, cert=‘ac/cert.pem’)

print resp

The output is a 200:

Response [200]

But I never see a request back to the listening server code you posted:

python3 server.py
Listening on localhost:8889

Any tips?

  1. step: python3 server.py
  2. step: another terminal: python3 actest.py
  3. step: power on the Samsung AC
root@raspberrypi:~# cat actest.py
import requests
s = requests.Session()
headers = {'content-type': 'text/xml'}
resp = s.post("https://192.168.1.36:8888/devicetoken/request", data={"DeviceToken":"xxxxxxxxxxx"}, headers=headers, stream=True, verify=False, cert='/etc/openhab2/services/cert.pem')
root@raspberrypi:~#
root@raspberrypi:~# python3 actest.py
/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
root@raspberrypi:~#

After I powered on the Samsung AC (on python3 server.py terminal):

root@raspberrypi:~# python3 test.py
Listening on localhost:8889


----- Request Start ----->

Request path: /devicetoken/response
Content Length: 0
Request headers: Host: 192.168.1.235:8889
Accept: */*

X-API-Version : v1.0.0
Content-Type: application/json
Content-Length: 28


Request payload: b''
Body: <__main__.RequestHandler object at 0x76a038f0>
Request payload: b'{"DeviceToken":"r42iD2EW1a"}'
<----- Request End -----

192.168.1.36 - - [12/Feb/2018 21:55:11] "POST /devicetoken/response HTTP/1.1" 200 -

May this will help, mine is working well.

@skavan Did you resolve problem with wind direction?

This is also working fine, just tried with the following commands:

example:

curl -s -X PUT -d '{"direction": "All"}' -k -H "Content-Type: application/json" -H "Authorization: Bearer XXXXXXXXXX" --cert '/etc/openhab2/services/cert.pem' --insecure https://192.168.1.XXX:8888/devices/0/wind
curl -s -X PUT -d '{"direction": "Up_And_Low"}' -k -H "Content-Type: application/json" -H "Authorization: Bearer XXXXXXXXXX" --cert '/etc/openhab2/services/cert.pem' --insecure https://192.168.1.XXX:8888/devices/0/wind
curl -s -X PUT -d '{"direction": "Left_And_Right"}' -k -H "Content-Type: application/json" -H "Authorization: Bearer XXXXXXXXXX" --cert '/etc/openhab2/services/cert.pem' --insecure https://192.168.1.XXX:8888/devices/0/wind
curl -s -X PUT -d '{"direction": "Fix"}' -k -H "Content-Type: application/json" -H "Authorization: Bearer XXXXXXXXXX" --cert '/etc/openhab2/services/cert.pem' --insecure https://192.168.1.XXX:8888/devices/0/wind
1 Like

But I never see a request back to the listening server code you posted:

Same problem, tested with Samsung Ecobubble washer (2017)
I get 200 response from /devicetoken/request, but I don’t receive anything on port 8889.

curl -v -k -H "Content-Type: application/json" -H "DeviceToken: xxxxxxxxxxx" --cert ~/Downloads/cert.pem --insecure -X POST https://192.168.1.4:8888/devicetoken/request

We resolved the issue with @cr0ntab

The problem was the order of the steps. Please follow my steps what I posted in Feb 12. If it is not working please get in contact with me. 0. step: Turn off the device.

Hi,

i tried the smart home and the smart air condition app.
I am not able to find the Password in the factoryhelper filte to generate the certificate.

Where i can find the Password - it is not so evident for me :wink:

My AC is brand new AR12MSPXBWKNEU

Hope it still works with that.
Please help me.

Best regards
Vaillan

Now i was able to create the Right certificate.

I can connect to the AC, but i get not Token from the AC.

I tried it with the python script, openssl command and with the binding.

With openssl and binding i get the response “invalid token”.


curl -XPOST -H "Content-Type: text/xml" -d "<?xml version=\"1.0\" encoding=\"utf-8\" ?><Request Type=\"GetToken\" />" --cert cert.pem "https://192.168.88.85:8888/capability" --insecure
{"errorCode":"0","errorDescription":"Token is not valid"}

With the Python Script i get this respone:

[14:06:49] openhabian@openHABianPi:/etc/openhab2/scripts$ python samsung_ac.py
Enter PEM pass phrase:
Traceback (most recent call last):
  File "samsung_ac.py", line 241, in <module>
    main()
  File "samsung_ac.py", line 210, in main
    ssl_sock = ssl_connect (creds_ac_birou.ip_addr, creds_ac_birou.port)
  File "samsung_ac.py", line 29, in ssl_connect
    ssl_sock.connect((ip, port))
  File "/usr/lib/python2.7/ssl.py", line 824, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python2.7/ssl.py", line 811, in _real_connect
    socket.connect(self, addr)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
TypeError: an integer is required

It is really hard to find out which Version (Python Script, openssl, samsungac Binding) works with my AC.

I want set the room tempertur automatic, so i really need to get it work.

Please help me.
Vaillan

Hi there,

I found this topic when I was looking for information about how to get status and things from my Samsung Smart washer.

As I understand, the port 8888 should be available, however, I can only see TCP Port 49154 open, and if I curl or telnet it, I’m only getting gibberish:
curl http://192.168.X.Y:49154
gc[a??ք*6?^?rtx~??f=??ܥ???+?7=??/?0???#?$?,?’?

Should I do something to enable the JSON port?

Cheers!

Sorry to intrude, I have been unable to add my Samsung Ac for over 2 years, any news of a new binding, maybe autodiscover?

The binding is not working with the new AC. But you can use the Exec binding with the scripts to get it working. If you need, I can help you to get it working.

Hi @skavan, Hi @miklosandras!

I am getting stucked early in the process while trying to create the certificate. The command to extract the certificate that was described by RemcoteWinkel in the older thread on Mar 5, 2016 throws an error:

connect: Connection refused
connect:errno=111

Thus the cert file is empty.

How did you managed it to create the certificate? I really looking forward to try the way you described here.

Thank you in advance for your help!

Hello @nbar

Here is the cert file, you can use it. I also downloaded it from the internet. :slight_smile:

Bag Attributes
    friendlyName: ac14k_m
    localKeyID: 54 69 6D 65 20 31 34 35 35 34 39 32 33 35 32 36 39 36
Key Attributes: <No Attributes>
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDeXvhcsqRFWfQt
Qr2TGW+ePJzrKQVNOZmCGFXrBmOKa2gcZvXqDe71upkCmbXxDZbsqU1nFox6WtKy
za+JE1EaWIjVFV/D0hnnF+CA56851rFjAx7YYVtd9TwJYV1lSfJaQBU/ecUys0SX
lKZJtjIoJ/PyLREE79TjOqTxXMXnDpiAt3oiwApZMweJ5z2QViqtRepkI33GDgYc
LzamIengSG6WZkEUr2roY0il4aVXf3IRVRX+5cJ2L5462kFPKm/UnrXrSsrLwbF9
ltSlNA8FgpHN3d9ZyqB3MB46oGYyxYYU7a+/R3RAx0joNfVPFe8riQXQcoNEgalb
c8f7N4HPAgMBAAECggEABL80QA5UMWLNMpYlI9m8Jz2V//MdONvM6hkI5H57a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UwgYkPsp+63Wklpcq7X7Q2NB7WscC4
rICqHxNow/KSzwuR6L3u/kewvlsrgTIM2Pp//+QdTK9GGU3HHAZKaNiB8m20k1Bs
NTANFxBk7alY0G7ZUhuzWkg6
-----END PRIVATE KEY-----
Bag Attributes
    friendlyName: ac14k_m
    localKeyID: 54 69 6D 65 20 31 34 35 35 34 39 32 33 35 32 36 39 36
subject=/C=KR/O=Samsung Electronics/CN=AC14K_M/emailAddress=AC14K_M@samsung.com
issuer=/C=KR/O=Samsung Electronics/CN=RemoteAccessCA(CE)
-----BEGIN CERTIFICATE-----
MIIDmzCCAoOgAwIBAgIBCTANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQGEwJLUjEc
MBoGA1UECgwTU2Ftc3VuZyBFbGVjdHJvbmljczEbMBkGA1UEAwwSUmVtb3RlQWNj
ZXNzQ0EoQ0UpMCIYDzE5NjAwMTAxMDAwMDAwWhgPMjA2MDAxMDEwMDAwMDBaMGEx
CzAJBgNVBAYTAktSMRwwGgYDVQQKExNTYW1zdW5nIEVsZWN0cm9uaWNzMRAwDgYD
VQQDFAdBQzE0S19NMSIwIAYJKoZIhvcNAQkBFhNBQzE0S19NQHNhbXN1bmcuY29t
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3l74XLKkRVn0LUK9kxlv
njyc6ykFTTmZghhV6wZjimtoHGb16g3u9bqZApm18Q2W7KlNZxaMelrSss2viRNR
GliI1RVfw9IZ5xfggOevOdaxYwMe2GFbXfU8CWFdZUnyWkAVP3nFMrNEl5SmSbYy
KCfz8i0RBO/U4zqk8VzF5w6YgLd6IsAKWTMHiec9kFYqrUXqZCN9xg4GHC82piHp
4EhulmZBFK9q6GNIpeGlV39yEVUV/uXCdi+eOtpBTypv1J6160rKy8GxfZbUpTQP
BYKRzd3fWcqgdzAeOqBmMsWGFO2vv0d0QMdI6DX1TxXvK4kF0HKDRIGpW3PH+zeB
zwIDAQABo3MwcTAdBgNVHQ4EFgQUXzEjosLzA6xbR1KAqnmAp3BNM6MwHwYDVR0j
BBgwFoAU/12TkC/BOF7xDaZZWJ+DGN6nMxcwDAYDVR0TBAUwAwEB/zAhBgNVHREE
GjAYggtzYW1zdW5nLmNvbYIJbG9jYWxob3N0MA0GCSqGSIb3DQEBBQUAA4IBAQBW
0mStlbdvrHqDJ+KOKVf0C/y9FKTODqo/6/wJNZeZ+8ezPza4nFq70MwQYTpSbZhz
5w8bQP9fwSAoa2Vki8ZwcSd85Vi2tHz9O4C7d7zBA3FU8AL3NoEMFv6OGWGPnTY5
mG/Hn+LxuwQddlysfbRDds1LBY8DBUJNAmIeeWqA5Eg8DW6xJUwHeXUElJpSXHW6
XGvpWgAhXqoIf6TirdCrPY6+IzV/FcuVtBDGi+JoxgrMfMLgLEVjeSY96DJinHgZ
RT0FkA5e06Z+fqHh9Btu+aed+kuGSmya/A5wStOkGeKEbezbbN2gtW07lN6VxX3J
OCgygA+hmnBVnRDA8Jzu
-----END CERTIFICATE-----
Bag Attributes
    friendlyName: CN=RemoteAccessCA(CE),O=Samsung Electronics,C=KR
subject=/C=KR/O=Samsung Electronics/CN=RemoteAccessCA(CE)
issuer=/C=KR/O=Samsung Electronics/CN=CECA
-----BEGIN CERTIFICATE-----
MIIDUTCCAjmgAwIBAgIBADANBgkqhkiG9w0BAQUFADA6MQswCQYDVQQGEwJLUjEc
MBoGA1UECgwTU2Ftc3VuZyBFbGVjdHJvbmljczENMAsGA1UEAwwEQ0VDQTAiGA8x
OTYwMDEwMTAwMDAwMFoYDzIwNjAwMTAxMDAwMDAwWjBIMQswCQYDVQQGEwJLUjEc
MBoGA1UECgwTU2Ftc3VuZyBFbGVjdHJvbmljczEbMBkGA1UEAwwSUmVtb3RlQWNj
ZXNzQ0EoQ0UpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtatz9GvV
qbV395Whnad9MC9TEOiXuwnw37QHvQUwOTFgc6AenX5SORfb4UTw+0ApFNba9DlY
Xx/K9E5b5DGasDVGGTn+z+6MPB7GuAjkP+WSRwHMjrHRNqrBOr1YJUw3SIbMkRoT
460k9AD9DQDBORRtGBGwcBw6BvdasA+/L3Q63aJ7pDoj3qxocdcgk/zFq0OrxFDL
PMTL7a+a9DS8G10K73XGgES0RBwwhlXXVuLUprD6RgbeLHFsPpIq5vzzEpAYMCF6
vkZKjDGEW7JVTgUu0E37niN3NQv1gIXlJusDH6RWfFQxENZsdFkT/l+kTuY283Ga
2Ei1HsW3Xpt88QIDAQABo1AwTjAdBgNVHQ4EFgQU/12TkC/BOF7xDaZZWJ+DGN6n
MxcwHwYDVR0jBBgwFoAURwF9jkihypJa2u6zRwKrZwRlACswDAYDVR0TBAUwAwEB
/zANBgkqhkiG9w0BAQUFAAOCAQEAZkjxN4O92e1RTaXx1mpazyT98sJVl46R51s1
CTPq35HVfTiBOAu0C5MR6a9vIIFJScy5h69VN4OwDDbMhe/k3m6EfAutlL7lRrre
OT853HJahxdavzaXJ7tcrI/yDJI0X5GbQ8W74mmDt2/5rXsaB+h+NrToGqf6Hvf/
m7ZhUnCAt0hhLmltxTVYS25s9KoiIH0rXOb9cqUFsmBMEG2pHWC5AiSc0cXJm+kU
3z0B2GS+4IjGdVr3FTPzzTXrpqq/X1cIVKAum5WfsFMS0CRvqTVNVwYg52n69T2B
NPCCEpp9rsIieZ58jsnc506Uc+1Vp+NmBI2A/ecypZxSb6v9gg==
-----END CERTIFICATE-----
Bag Attributes
    friendlyName: CN=CECA,O=Samsung Electronics,C=KR
subject=/C=KR/O=Samsung Electronics/CN=CECA
issuer=/C=KR/O=Samsung Electronics/CN=ROOTCA
-----BEGIN CERTIFICATE-----
MIIDRTCCAi2gAwIBAgIBBDANBgkqhkiG9w0BAQUFADA8MQswCQYDVQQGEwJLUjEc
MBoGA1UECgwTU2Ftc3VuZyBFbGVjdHJvbmljczEPMA0GA1UEAwwGUk9PVENBMCIY
DzE5NjAwMTAxMDAwMDAwWhgPMjA2MDAxMDEwMDAwMDBaMDoxCzA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9NueH80tpZ9KqFnqnOoLxTAa7k0RPBRwyUO9CDhSnlWIEcsD9sqR2M+niOFnT
KBHcLDDiEU3llprD8FRV3unYrl0F0B2GGdRk
-----END CERTIFICATE-----

@miklosandras: Thank you very much!!!

1 Like

Hi miklosandras

Im also having trouble getting the cert working and getting the token.
Ive copied the cert you posted into a text file and renamed it cert.pem and ran the following command (windows shell) from the same location where ive put the cert.pem file mentioned.

curl -k -H “Content-Type: application/json” -H “DeviceToken: xxxxxxxxxxx” --cert cert.pem --insecure -X POST https://192.168.1.93:8888/devicetoken/request

and I get the following result:

400 No required SSL certificate was sent

400 Bad Request

No required SSL certificate was sent
nginx/1.2.7

It seems It can see or just doesnt accept the cert.pem Ive put in the same path I ran the command no matter what i do

Ok after a few attempts managed to get this response from the server script
This was after doing the following steps starting with the ac off

Listening on localhost:8889

----- Request Start ----->

Request path: /devicetoken/response
Content Length: 0
Request headers: Host: 192.168.1.84:8889
Accept: /

X-API-Version : v1.0.0
Content-Type: application/json
Content-Length: 28

Request payload: b’’
Body: <main.RequestHandler object at 0x00000183F1A9A5F8>
<----- Request End -----

192.168.1.93 - - [23/Jan/2019 12:21:39] “POST /devicetoken/response HTTP/1.1” 200 -

Basically the respose object is not getting the token.
Any ideas?