Skip to content

Commit 2bf5d1b

Browse files
Alberto Iannacconefacchinm
Alberto Iannaccone
authored andcommitted
print compressed cert only in debug mode
1 parent f5228c8 commit 2bf5d1b

File tree

2 files changed

+13
-24
lines changed

2 files changed

+13
-24
lines changed

examples/utility/Provisioning/Provisioning.ino

+13-9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <ArduinoBearSSL.h>
66
#include <ArduinoECCX08.h>
77

8+
const bool DEBUG = true;
89
const int keySlot = 0;
910
const int compressedCertSlot = 10;
1011
const int serialNumberAndAuthorityKeyIdentifierSlot = 11;
@@ -127,22 +128,25 @@ void setup() {
127128
while (1);
128129
}
129130

130-
Serial.println("Compressed cert = ");
131+
if (DEBUG) {
132+
Serial.println("Compressed cert = ");
131133

132-
const byte* certData = ECCX08Cert.bytes();
133-
int certLength = ECCX08Cert.length();
134+
const byte* certData = ECCX08Cert.bytes();
135+
int certLength = ECCX08Cert.length();
134136

135-
for (int i = 0; i < certLength; i++) {
136-
byte b = certData[i];
137+
for (int i = 0; i < certLength; i++) {
138+
byte b = certData[i];
137139

138-
if (b < 16) {
139-
Serial.print('0');
140+
if (b < 16) {
141+
Serial.print('0');
142+
}
143+
Serial.print(b, HEX);
140144
}
141-
Serial.print(b, HEX);
145+
Serial.println();
142146
}
143-
Serial.println();
144147
}
145148

149+
146150
void loop() {
147151
}
148152

src/ArduinoCloud.cpp

-15
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,6 @@ int ArduinoCloudClass::begin(Client& net)
5252
return 0;
5353
}
5454

55-
Serial.println("Compressed cert = ");
56-
57-
const byte* certData = ECCX08Cert.bytes();
58-
int certLength = ECCX08Cert.length();
59-
60-
for (int i = 0; i < certLength; i++) {
61-
byte b = certData[i];
62-
63-
if (b < 16) {
64-
Serial.print('0');
65-
}
66-
Serial.print(b, HEX);
67-
}
68-
Serial.println();
69-
7055
if (_bearSslClient) {
7156
delete _bearSslClient;
7257
}

0 commit comments

Comments
 (0)