I try to connect the NodeMCU with the IBM Bluemix IoT Foundation. The unsecured MQTT connect works splendid and pushes data from a BMP180 to the cloud. However, when I start using TLS it won't connect to the broker. I tried to make a TLS connection with mqtt.fx and it works fine, it seems like the NodeMCU is the problem.
If I run this code:
orgID="****"
BROKER = orgID..".<bluemix>"
BRPORT = 8883
CLIENTID = "d:"..orgID..":generic_esp:generic_esp_01"
print("ClientID: "..CLIENTID)
BRPWD = "***********"
BRUSER = "use-token-auth"
local function publish()
dofile('sensor.lc')
m:publish('iot-2/evt/esp8266/fmt/json',payload,1,0,
function(conn) print('Payload published') end)
end
m = mqtt.Client(CLIENTID, 120, BRUSER, BRPWD)
c = false
print('MQTT Init')
m:on('offline', function(con) print('mqtt offline'); c = false end)
m:connect(BROKER, BRPORT, 1, function(conn)
print('MQTT connected: '..BROKER..':'..BRPORT)
c = true
publish()
end)
tmr.alarm(1, 1000, 1, function()
if not c then
print('MQTT reconnecting')
m:close()
c = false
m:connect(BROKER, BRPORT, 1, function(conn) print('.. MQTT reconnected: '..BROKER..':'..BRPORT); c = true end)
end
if c then
publish()
end
end)
the esp8266 just prints "MQTT reconnecting" and can't connect.
Is something wrong with my code or is TLS not fully supported in NodeMCU 1.4, yet?
I've captured the your client hello in one of our test stands:
0000 16 03 02 00 33 01 00 00 2f 03 02 00 00 00 00 d0
0010 b1 a1 3a 07 1c 1b 3e f2 fc 03 91 d6 18 b5 ae 5d
0020 77 65 37 f5 07 10 45 d1 7e 1a ea 00 00 08 00 2f
0030 00 35 00 05 00 04 01 00
This looks like a TLS v1.1 client hello. Usually a client will hello with the "best" it can do and be negotiated downwards. In this case IoTF will simply close the connection because it only supports TLS 1.2. Please can you check that your device is setup to do TLS 1.2 ?
Related
I am trying to remote authentication for tachograph. I have a problem between tachograph and can bus communication. i am successful open session 10 7E and send company card ATR. But when i passed to authentication of company card.
i send : 0x31,0x01,0x01,0x80,0x03.
tacho respond: 10 0C 71 01 01 80 04 00
i send fc : 30 00 14 00 00 00 00 00
but tacho not respond me. Can anyone give me any idea?
I want to configure a Kollmorgen drive to rotate a motor with constant velocity via CANopen. I am using SDO mode for it.
My drive device id is 0614. So far I have configured it as:
Id=0614, Data= 2F 04 22 00 50 00 00 00 'Set run current to 80%
Id=0614, Data= 23 84 60 00 40 42 0F 00 'Set deceleration to 1M steps/sec^2
Id=0614, Data= 23 83 60 00 40 42 0F 00 'Set acceleration to 1M steps/sec^2
Enable motor power
Id=0614, Data= 2B 40 60 00 06 00 00 00 'Ready to Switch on
Id=0614, Data= 2B 40 60 00 07 00 00 00 'Switched on
Id=0614, Data= 2B 40 60 00 0F 00 00 00 'Operation Enable
Set to Profile Velocity Mode
Id=0614, Data= 2F 60 60 00 03 00 00 00 'Set to Profile Velocity Mode
Target Velocity -
Id=0614, Data= 23 FF 60 00 50 C3 00 00 'Target Velocity 50K
The problem I am facing is that whenever I am trying to enable the drive it gets disabled automatically. When I try to read StatusWord is gives 0270. Which means the device is disabled. It doesn't give any warning or fault.
the device Id in canopen protocol could not be bigger than 127. the COB ID of SDO download is 0x600+nodeID and the COB ID of SDO upload is 0x580+nodeID
I think the Id of your device is 0x14.also sdo DOWNLOAD message just include 4 bytes of data and the second third and fourth data are including the address OD 'S index and sub index that you want write to it and the first byte is specifier that is shown below
Please,
I am trying to write a simple Binary Block to mifare 1k tag with a ACR122U reader.
I am trying write to block 01, 5 bytes, text:'teste' and read it back.
But I always get an error 6300 when update this block.
Any thoughts?
I am using windows 8.1/delphi xe8.
My log is:
SCardEstablishContext succeeded.
Card State changed in ACS ACR122U PICC Interface 0 to available
New reader found: ACS ACR122U PICC Interface 0
Card inserted in ACS ACR122U PICC Interface 0
ATR = 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A
SCardConnect (shared) succeeded.
Active Protocol: T=1
ISO 14443 A, Part3 Card Type: Mifare Standard 1K is detected
Sending APDU to card: FF 82 00 01 06 FF FF FF FF FF FF
SCardTransmit succeeded.
Card response status word: 9000 (OK)
Sending APDU to card: FF 86 00 00 05 01 00 01 60 01
SCardTransmit succeeded.
Card response status word: 9000 (OK)
Sending APDU to card: FF 86 00 00 05 01 00 01 60 01
SCardTransmit succeeded.
Card response status word: 9000 (OK)
Sending APDU to card: FF D6 00 01 05 74 65 73 74 65
SCardTransmit succeeded.
Card response status word: 6300 (State of non-volatile memory changed.)
This is easily resolved by reading the documentation.
You're writing to a block and you have to provide a complete block of information. The only option for Lc is x04 or x10 - four bytes or sixteen bytes. For the Mifare 1K, it's prettly clear that you need to supply 16 bytes. You have only 5 bytes of data, so pad the rest with zeros.
| CMD | block1 | 16 bytes | data ...
FF D6 00 01 10 74 65 73 74 65 00 00 00 00 00 00 00 00 00 00 00
I am trying to implement RADIUS protocol. As per the RFC 2866, for RADIUS Accounting, when calculating the Authenticator field these are the steps:
The Authenticator field in an Accounting-Response packet is called
the Response Authenticator, and contains a one-way MD5 hash
calculated over a stream of octets consisting of the Accounting-
Response Code, Identifier, Length, the Request Authenticator field
from the Accounting-Request packet being replied to, and the
response attributes if any, followed by the shared secret. The
resulting 16 octet MD5 hash value is stored in the Authenticator
field of the Accounting-Response packet.
I am trying to calculate it and I can not get the right value:
Code = 5 (0x05) 1 byte
Identifier: 134 (0x86) 1 byte
Length: 20 (0x0014) 2 bytes
Request Authenticator: bac85592365b2e786ad3095a1cf22646 , 16 bytes
There are no Attributes in my response
Shared-secret: 63 21 6d 40 35 32 32 35 (c!m#5225)
so the input for the MD% hash would be:
05860014bac85592365b2e786ad3095a1cf2264663216d4035323235
and I get:
b7ac1e6909302b06bd021aede380dbc5 using these 2 web sites: http://www.md5hashgenerator.com/ and http://www.miraclesalad.com/webtools/md5.php
The actual response has the Authenticator as 9629702dca9469714fb423ca7b1525bc
i am comparing looking at real RADIUS packets being sent by the client/server and the Authenticator that I calculate does not match the one sent by the Server. Any ideas what can be it?
The RFC 2865 at the end has a couple of examples. Example 1, using the shared
secret "xyzzy5461"
User Telnet to Specified Host
The NAS at 192.168.1.16 sends an Access-Request UDP packet to the
RADIUS Server for a user named nemo logging in on port 3 with
password "arctangent".
The Request Authenticator is a 16 octet random number generated by
the NAS.
The User-Password is 16 octets of password padded at end with nulls,
XORed with MD5(shared secret|Request Authenticator).
01 00 00 38 0f 40 3f 94 73 97 80 57 bd 83 d5 cb
98 f4 22 7a 01 06 6e 65 6d 6f 02 12 0d be 70 8d
93 d4 13 ce 31 96 e4 3f 78 2a 0a ee 04 06 c0 a8
01 10 05 06 00 00 00 03
1 Code = Access-Request (1)
1 ID = 0
2 Length = 56
16 Request Authenticator
Attributes:
6 User-Name = "nemo"
18 User-Password
6 NAS-IP-Address = 192.168.1.16
6 NAS-Port = 3
The RADIUS server authenticates nemo, and sends an Access-Accept UDP
packet to the NAS telling it to telnet nemo to host 192.168.1.3.
The Response Authenticator is a 16-octet MD5 checksum of the code
(2), id (0), Length (38), the Request Authenticator from above, the
attributes in this reply, and the shared secret.
02 00 00 26 86 fe 22 0e 76 24 ba 2a 10 05 f6 bf
9b 55 e0 b2 06 06 00 00 00 01 0f 06 00 00 00 00
0e 06 c0 a8 01 03
1 Code = Access-Accept (2)
1 ID = 0 (same as in Access-Request)
2 Length = 38
16 Response Authenticator
Attributes:
6 Service-Type (6) = Login (1)
6 Login-Service (15) = Telnet (0)
6 Login-IP-Host (14) = 192.168.1.3
Problem solved! The online md5 tools expect strings, so even though I was passing the bytes values it was being treated as string, hence the wrong value.
Using an android mobile device I could read the card details(authorized by the client with touch id) from iphone6, for payment transaction through NFC. I got it working through the APDU request.
APDU request
Send : 00 A4 04 00 07 A0 00 00 00 03 10 10 00
and response
Response: 6F 39 84 07 A0 00 00 00 03 10 10 A5 2E 9F 38 1B 9F 66 04 9F 02 06 9F 03 06 9F 1A 02 95 05 5F 2A 02 9A 03 9C 01 9F 37 04 9F 4E 14 BF 0C 0D 9F 4D 02 14 01 9F 5A 05 11 08 40 08 40 90 00
Now my concern is, can I send the same APDU request from iPhone 6 through NFC or some other means to get the appropriate response from another iPhone 6? Is it possible?
Though I can understand that NFC chip in iPhone6 does not allow iPhone-Iphone NFC communication, this question clearly states that THERE IS NO WAY to read passive NFC tags using an iPhone6. Okay, but there are comments saying it might be possible after september2014?
There must be some way to do this, Please do give out your thoughts on this. Thanks.
As I pointed out in this thread, the iPhone6 is not designed for Discovery mode or to act as a master in Peer-to-peer mode. You can however use a mobile NFC reader to proxy NFC data between 2 iPhones. Flomio offers a line of mobile and PC compatible NFC readers that you may consider.
Also worth mentioning, there's another option in reading unique data off the iPhone6 that may address your needs as well. Check this thread for details.