Skip to content

Commit 34dfa60

Browse files
committed
SElementCertificate: handle newPrivateKey flag
1 parent 840303c commit 34dfa60

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/utility/SElementCertificate.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ int SElementCertificate::build(SecureElement & se, ECP256Certificate & cert, con
1919
byte publicKey[ECP256_CERT_PUBLIC_KEY_LENGTH];
2020
byte signature[ECP256_CERT_SIGNATURE_LENGTH];
2121

22-
if (!se.generatePublicKey(keySlot, publicKey)) {
23-
return 0;
22+
if(newPrivateKey) {
23+
if (!se.generatePrivateKey(keySlot, publicKey)) {
24+
return 0;
25+
}
26+
} else {
27+
if (!se.generatePublicKey(keySlot, publicKey)) {
28+
return 0;
29+
}
2430
}
2531

2632
/* Store public key in Certificate */

0 commit comments

Comments
 (0)