Load ipsec.conf %smartcard leftcerts with pkcs11 builder
This commit is contained in:
@@ -133,7 +133,18 @@ METHOD(stroke_cred_t, load_peer, certificate_t*,
|
|||||||
{
|
{
|
||||||
certificate_t *cert;
|
certificate_t *cert;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
|
chunk_t keyid;
|
||||||
|
|
||||||
|
if (strneq(filename, "%smartcard:", strlen("%smartcard:")))
|
||||||
|
{
|
||||||
|
keyid = chunk_create(filename, strlen(filename));
|
||||||
|
keyid = chunk_from_hex(chunk_skip(keyid, strlen("%smartcard:")), NULL);
|
||||||
|
cert = lib->creds->create(lib->creds, CRED_CERTIFICATE, CERT_X509,
|
||||||
|
BUILD_PKCS11_KEYID, keyid, BUILD_END);
|
||||||
|
free(keyid.ptr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (*filename == '/')
|
if (*filename == '/')
|
||||||
{
|
{
|
||||||
snprintf(path, sizeof(path), "%s", filename);
|
snprintf(path, sizeof(path), "%s", filename);
|
||||||
@@ -147,6 +158,7 @@ METHOD(stroke_cred_t, load_peer, certificate_t*,
|
|||||||
CRED_CERTIFICATE, CERT_ANY,
|
CRED_CERTIFICATE, CERT_ANY,
|
||||||
BUILD_FROM_FILE, path,
|
BUILD_FROM_FILE, path,
|
||||||
BUILD_END);
|
BUILD_END);
|
||||||
|
}
|
||||||
if (cert)
|
if (cert)
|
||||||
{
|
{
|
||||||
cert = this->creds->add_cert_ref(this->creds, TRUE, cert);
|
cert = this->creds->add_cert_ref(this->creds, TRUE, cert);
|
||||||
|
|||||||
Reference in New Issue
Block a user