xca/lib/pki_x509super.cpp
Christian Hohnstaedt 0aced7f2c4 improve Smart-card handling
- if PublicKey or Cert CKA_LABEL fails, try CKA_SUBJECT
 - don't use CKA_VALUE attribute on PUBLIC_KEY,
   because not everyone supports it.
   While being at it, add code for DSA and EC Cards.
 - load PKCS#11 engine only after database open.
 - avoid reloading the DLL on windows, because it is not supported.
   Windows users need to restart XCA after changing the PKCS#11 path
 - fix getSlotList() and return a QList<unsigned long>
2009-11-11 22:58:34 +01:00

54 lines
865 B
C++

/* vi: set sw=4 ts=4:
*
* Copyright (C) 2001 - 2007 Christian Hohnstaedt.
*
* All rights reserved.
*/
#include "pki_x509super.h"
pki_x509super::pki_x509super(const QString name)
: pki_base(name)
{
privkey = NULL;
}
pki_x509super::~pki_x509super()
{
if (privkey)
privkey->decUcount();
privkey = NULL;
}
pki_key *pki_x509super::getRefKey() const
{
return privkey;
}
void pki_x509super::setRefKey(pki_key *ref)
{
if (ref == NULL || ref->isPubKey() || privkey != NULL )
return;
pki_key *mk = getPubKey();
if (ref->compare(mk)) {
// this is our key
privkey = ref;
ref->incUcount();
}
delete mk;
}
void pki_x509super::delRefKey(pki_key *ref)
{
if (ref != privkey || ref == NULL)
return;
ref->decUcount();
privkey = NULL;
}
void pki_x509super::autoIntName()
{
x509name subject = getSubject();
setIntName(subject.getMostPopular());
}