X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2Fsecurity%2FBasicX509Credential.h;h=f76465b8991517af538350b4fbc6f7e34bfbb2ee;hb=b383e021ae585cf97bf24285f65ae1e451b893e8;hp=6225f69eb136834efc0b006155aef7e7f41078ba;hpb=cb5804ce4c3915b1e37517438bf10e3019befc75;p=shibboleth%2Fxmltooling.git diff --git a/xmltooling/security/BasicX509Credential.h b/xmltooling/security/BasicX509Credential.h index 6225f69..f76465b 100644 --- a/xmltooling/security/BasicX509Credential.h +++ b/xmltooling/security/BasicX509Credential.h @@ -24,13 +24,10 @@ #define __xmltooling_basicx509cred_h__ #include +#include #include -namespace xmlsignature { - class XMLTOOL_API KeyInfo; -}; - namespace xmltooling { /** @@ -39,6 +36,11 @@ namespace xmltooling { class XMLTOOL_API BasicX509Credential : public virtual X509Credential { protected: + /** + * Constructor. + * + * @param ownCerts true iff any certificates subsequently stored should be freed by destructor + */ BasicX509Credential(bool ownCerts) : m_key(NULL), m_ownCerts(ownCerts), m_crl(NULL), m_keyInfo(NULL), m_compactKeyInfo(NULL) { } @@ -56,6 +58,9 @@ namespace xmltooling { /** The private/secret key/keypair. */ XSECCryptoKey* m_key; + /** Key names (derived from credential, KeyInfo, or both). */ + std::set m_keyNames; + /** The X.509 certificate chain. */ std::vector m_xseccerts; @@ -79,6 +84,12 @@ namespace xmltooling { public: virtual ~BasicX509Credential(); + UsageTypes getUsage() const { + return UNSPECIFIED_CREDENTIAL; + } + const char* getAlgorithm() const; + unsigned int getKeySize() const; + XSECCryptoKey* getPrivateKey() const { if (m_key) { XSECCryptoKey::KeyType type = m_key->getKeyType(); @@ -96,19 +107,17 @@ namespace xmltooling { } return NULL; } + + const std::set& getKeyNames() const { + return m_keyNames; + } - std::vector::size_type getKeyNames(std::vector& results) const; - - const xmlsignature::KeyInfo* getKeyInfo(bool compact=false) const { - return compact ? m_compactKeyInfo : (m_keyInfo ? m_keyInfo : m_compactKeyInfo); + xmlsignature::KeyInfo* getKeyInfo(bool compact=false) const { + if (compact || !m_keyInfo) + return m_compactKeyInfo ? m_compactKeyInfo->cloneKeyInfo() : NULL; + return m_keyInfo->cloneKeyInfo(); } - /** - * Gets an immutable collection of certificates in the entity's trust chain. The entity certificate is contained - * within this list. No specific ordering of the certificates is guaranteed. - * - * @return a certificate chain - */ const std::vector& getEntityCertificateChain() const { return m_xseccerts; }