+ bool matches(const xmltooling::Credential& credential) const {
+ const MetadataCredentialContext* context = dynamic_cast<const MetadataCredentialContext*>(credential.getCredentalContext());
+ if (context) {
+ // Check for a usage mismatch.
+ if ((getUsage() | (xmltooling::Credential::SIGNING_CREDENTIAL & xmltooling::Credential::TLS_CREDENTIAL)) &&
+ XMLString::equals(context->getKeyDescriptor().getUse(),KeyDescriptor::KEYTYPE_ENCRYPTION))
+ return false;
+ else if ((getUsage() | xmltooling::Credential::ENCRYPTION_CREDENTIAL) &&
+ XMLString::equals(context->getKeyDescriptor().getUse(),KeyDescriptor::KEYTYPE_SIGNING))
+ return false;
+ }
+ return CredentialCriteria::matches(credential);
+ }
+