improved build scripts
This commit is contained in:
10
configure.ac
10
configure.ac
@@ -23,11 +23,17 @@ AC_ARG_ENABLE(pkcs11-download,
|
|||||||
[download pkcs11 header])],
|
[download pkcs11 header])],
|
||||||
[have_pedantic="$enableval"
|
[have_pedantic="$enableval"
|
||||||
if test "$enableval" = "yes"; then
|
if test "$enableval" = "yes"; then
|
||||||
mkdir -p usr/include
|
test -d usr/include || mkdir -p usr/include
|
||||||
cd usr/include
|
cd usr/include
|
||||||
for f in $(wget -q -O- ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-20/ 2>&1 | html2 | sed -n 's,.*/a/@href=\(.*\.h\)$,\1,gp'); do
|
for f in $(wget -qO- ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-20/ 2>&1 | html2 | sed -n 's,.*/a/@href=\(.*\.h\)$,\1,gp'); do
|
||||||
wget --unlink $f
|
wget --unlink $f
|
||||||
|
if ! test -f "${f##*/}"; then
|
||||||
|
AC_MSG_ERROR([download failed of PKCS#11 header file: ${f##*/}])
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
if ! test -f cryptoki.h; then
|
||||||
|
AC_MSG_ERROR([download failed of PKCS#11 - have you installed xml2?])
|
||||||
|
fi
|
||||||
AM_CPPFLAGS+=" -I$(pwd)"
|
AM_CPPFLAGS+=" -I$(pwd)"
|
||||||
cd -
|
cd -
|
||||||
fi
|
fi
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
#include <pcsc.hxx>
|
#include <pcsc.hxx>
|
||||||
#include <mrw/vector.hxx>
|
#include <mrw/vector.hxx>
|
||||||
#include <mrw/checkcxx11.hxx>
|
#include <mrw/checkcxx11.hxx>
|
||||||
|
#include <mrw/regexp.hxx>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
/*! @defgroup gsuisseid C++ library to access SuisseID smart cards
|
/*! @defgroup gsuisseid C++ library to access SuisseID smart cards
|
||||||
@@ -149,19 +150,31 @@ namespace suisseid {
|
|||||||
public:
|
public:
|
||||||
Certificate(const std::string& v,
|
Certificate(const std::string& v,
|
||||||
const std::string& l,
|
const std::string& l,
|
||||||
|
const std::string& s,
|
||||||
|
const std::string& si,
|
||||||
const cryptoki::Attribute& i):
|
const cryptoki::Attribute& i):
|
||||||
std::string(v),
|
std::string(v),
|
||||||
_label(l),
|
_label(l),
|
||||||
|
_subject(s),
|
||||||
|
_si(si),
|
||||||
_id(i) {
|
_id(i) {
|
||||||
}
|
}
|
||||||
const std::string& label() {
|
const std::string& label() {
|
||||||
return _label;
|
return _label;
|
||||||
}
|
}
|
||||||
|
const std::string& subject() {
|
||||||
|
return _label;
|
||||||
|
}
|
||||||
const cryptoki::Attribute& id() {
|
const cryptoki::Attribute& id() {
|
||||||
return _id;
|
return _id;
|
||||||
}
|
}
|
||||||
|
const std::string& subjectInfo() {
|
||||||
|
return _si;
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
std::string _label;
|
std::string _label;
|
||||||
|
std::string _subject;
|
||||||
|
std::string _si;
|
||||||
cryptoki::Attribute _id;
|
cryptoki::Attribute _id;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -269,6 +282,8 @@ namespace suisseid {
|
|||||||
cert!=certs.end(); ++cert)
|
cert!=certs.end(); ++cert)
|
||||||
res.push_back(Certificate(cert->attribute(CKA_VALUE).value,
|
res.push_back(Certificate(cert->attribute(CKA_VALUE).value,
|
||||||
cert->attribute(CKA_LABEL).value,
|
cert->attribute(CKA_LABEL).value,
|
||||||
|
cert->attribute(CKA_SUBJECT).value,
|
||||||
|
cert->attribute(CKA_SUBJECT_INFO).value,
|
||||||
cert->attribute(CKA_ID)));
|
cert->attribute(CKA_ID)));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -308,6 +323,7 @@ namespace suisseid {
|
|||||||
for (cryptoki::ObjectList::iterator cert(certs.begin());
|
for (cryptoki::ObjectList::iterator cert(certs.begin());
|
||||||
cert!=certs.end(); ++cert) // return first matching cert
|
cert!=certs.end(); ++cert) // return first matching cert
|
||||||
return Certificate(cert->attribute(CKA_VALUE).value,
|
return Certificate(cert->attribute(CKA_VALUE).value,
|
||||||
|
cert->attribute(CKA_SUBJECT).value,
|
||||||
cert->attribute(CKA_LABEL).value,
|
cert->attribute(CKA_LABEL).value,
|
||||||
id);
|
id);
|
||||||
# ifdef __APPLE__
|
# ifdef __APPLE__
|
||||||
@@ -355,10 +371,16 @@ namespace suisseid {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
enum CardType {
|
||||||
|
SUISSE_ID,
|
||||||
|
UNKNOWN
|
||||||
|
};
|
||||||
|
|
||||||
/// @copydoc Card::Card
|
/// @copydoc Card::Card
|
||||||
Post(std::shared_ptr<pcsc::Connection::Reader> reader,
|
Post(std::shared_ptr<pcsc::Connection::Reader> reader,
|
||||||
const cryptoki::Library& cryptoki):
|
const cryptoki::Library& cryptoki):
|
||||||
Card(reader, cryptoki), _minPinLen(0), _maxPinLen((unsigned int)-1) {
|
Card(reader, cryptoki),
|
||||||
|
_type(UNKNOWN), _minPinLen(0), _maxPinLen((unsigned int)-1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual unsigned int minimalPinLength() {
|
virtual unsigned int minimalPinLength() {
|
||||||
@@ -379,7 +401,12 @@ namespace suisseid {
|
|||||||
virtual CertStatus certStatus() {
|
virtual CertStatus certStatus() {
|
||||||
try {
|
try {
|
||||||
Certificate auth(authenticationCertificate());
|
Certificate auth(authenticationCertificate());
|
||||||
Certificate sig(digitalSignatureCertificate());
|
//auth.subjectInfo(serialNumber);
|
||||||
|
// if (mrw::RegExp("^$[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{4}")
|
||||||
|
// (auth.subjectInfo(serialNumber))) {
|
||||||
|
// _type = SUISSE_ID;
|
||||||
|
Certificate sig(digitalSignatureCertificate());
|
||||||
|
// }
|
||||||
return VALID;
|
return VALID;
|
||||||
} catch (const no_auth& x) {
|
} catch (const no_auth& x) {
|
||||||
return MISSING;
|
return MISSING;
|
||||||
@@ -430,6 +457,7 @@ namespace suisseid {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
CardType _type;
|
||||||
std::string _version; // version is cached
|
std::string _version; // version is cached
|
||||||
unsigned int _minPinLen; // minimal PIN length is cached
|
unsigned int _minPinLen; // minimal PIN length is cached
|
||||||
unsigned int _maxPinLen; // maximal PIN length is cached
|
unsigned int _maxPinLen; // maximal PIN length is cached
|
||||||
|
Reference in New Issue
Block a user