@@ -92,43 +92,47 @@ void ClaimingHandlerClass::poll() {
92
92
}
93
93
94
94
void ClaimingHandlerClass::getIdReqHandler () {
95
- if (_ts != 0 ) {
96
- byte _uhwidBytes[32 ];
97
- hex::decode (_uhwid->c_str (), _uhwidBytes, _uhwid->length ());
98
- // Send UHWID
99
- ProvisioningOutputMessage idMsg = {MessageOutputType::UHWID};
100
- idMsg.m .uhwid = _uhwidBytes;
101
- _agentManager.sendMsg (idMsg);
102
-
103
- String token = generateToken ();
104
- if (token == " " ) {
105
- DEBUG_ERROR (" CH::%s Error: token not created" , __FUNCTION__);
106
- sendStatus (StatusMessage::ERROR);
107
- return ;
108
- }
109
-
110
- // Send JWT
111
- ProvisioningOutputMessage jwtMsg = {MessageOutputType::JWT};
112
- jwtMsg.m .jwt = token.c_str ();
113
- _agentManager.sendMsg (jwtMsg);
114
- _ts = 0 ;
115
-
116
- SElementJWS sejws;
117
- String publicKey = sejws.publicKey (*_secureElement, 1 , false );
118
- if (publicKey == " " ) {
119
- DEBUG_ERROR (" CH::%s Error: public key not created" , __FUNCTION__);
120
- sendStatus (StatusMessage::ERROR);
121
- return ;
122
- }
123
-
124
- // Send public key
125
- ProvisioningOutputMessage publicKeyMsg = {MessageOutputType::PROV_PUBLIC_KEY};
126
- publicKeyMsg.m .provPublicKey = publicKey.c_str ();
127
- _agentManager.sendMsg (publicKeyMsg);
128
- } else {
95
+ if (_ts == 0 ) {
129
96
DEBUG_ERROR (" CH::%s Error: timestamp not provided" , __FUNCTION__);
130
97
sendStatus (StatusMessage::PARAMS_NOT_FOUND);
98
+ return ;
99
+ }
100
+
101
+ byte _uhwidBytes[32 ];
102
+ hex::decode (_uhwid->c_str (), _uhwidBytes, _uhwid->length ());
103
+
104
+ String token = generateToken ();
105
+ if (token == " " ) {
106
+ DEBUG_ERROR (" CH::%s Error: token not created" , __FUNCTION__);
107
+ sendStatus (StatusMessage::ERROR);
108
+ return ;
131
109
}
110
+
111
+ SElementJWS sejws;
112
+ String publicKey = sejws.publicKey (*_secureElement, 1 , false );
113
+ if (publicKey == " " ) {
114
+ DEBUG_ERROR (" CH::%s Error: public key not created" , __FUNCTION__);
115
+ sendStatus (StatusMessage::ERROR);
116
+ return ;
117
+ }
118
+
119
+ // Send public key
120
+ ProvisioningOutputMessage publicKeyMsg = {MessageOutputType::PROV_PUBLIC_KEY};
121
+ publicKeyMsg.m .provPublicKey = publicKey.c_str ();
122
+ _agentManager.sendMsg (publicKeyMsg);
123
+
124
+
125
+ // Send UHWID
126
+ ProvisioningOutputMessage idMsg = {MessageOutputType::UHWID};
127
+ idMsg.m .uhwid = _uhwidBytes;
128
+ _agentManager.sendMsg (idMsg);
129
+
130
+ // Send JWT
131
+ ProvisioningOutputMessage jwtMsg = {MessageOutputType::JWT};
132
+ jwtMsg.m .jwt = token.c_str ();
133
+ _agentManager.sendMsg (jwtMsg);
134
+ _ts = 0 ;
135
+
132
136
}
133
137
134
138
void ClaimingHandlerClass::resetStoredCredReqHandler () {
0 commit comments