private function validateCredential(PassphraseCredential $credential, $provides_type)
 {
     $type = $credential->getImplementation();
     if (!$type) {
         throw new Exception(pht('Credential "%s" is of unknown type "%s"!', $credential->getMonogram(), $credential->getCredentialType()));
     }
     if ($type->getProvidesType() !== $provides_type) {
         throw new Exception(pht('Credential "%s" must provide "%s", but provides "%s"!', $credential->getMonogram(), $provides_type, $type->getProvidesType()));
     }
 }