Skip to content

Commit

Permalink
Add -X flag for seperate pkcs11 uri for Certificate
Browse files Browse the repository at this point in the history
Ex. ldid -K'pkcs11:object=MyKey;type=private' -X'pkcs11:object=MyKey;type=cert'
  • Loading branch information
CRKatri committed Mar 19, 2024
1 parent 88b05b3 commit 22304ec
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ldid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
#include <sys/stat.h>
#include <sys/types.h>

# if SMARTCARD
# define OPENSSL_SUPPRESS_DEPRECATED
/* We need to use engines, which are deprecated */
# endif

#include <openssl/opensslv.h>
# if OPENSSL_VERSION_MAJOR >= 3
# include <openssl/provider.h>
Expand Down Expand Up @@ -3506,6 +3511,7 @@ int main(int argc, char *argv[]) {
Map entitlements;
Map requirements;
std::string key;
std::string certuri;
ldid::Signer *signer = new NoSigner();
ldid::Slots slots;

Expand Down Expand Up @@ -3714,6 +3720,11 @@ int main(int argc, char *argv[]) {
key = argv[argi] + 2;
break;

case 'X':
if (argv[argi][2] != '\0')
certuri = argv[argi] + 2;
break;

case 'T': break;

case 'u': {
Expand Down Expand Up @@ -3741,7 +3752,7 @@ int main(int argc, char *argv[]) {
if (!key.empty()) {
#if SMARTCARD
if (key.compare(0, 7, "pkcs11:") == 0) {
signer = new P11Signer(key);
signer = new P11Signer(key, certuri.empty() ? key : certuri);
} else
#endif
{
Expand Down

0 comments on commit 22304ec

Please sign in to comment.