Require certificate common name instead of full path on check

This commit is contained in:
Niklas Keller
2016-03-12 17:30:44 +01:00
parent fc8907b984
commit afba80cc23
3 changed files with 21 additions and 14 deletions

View File

@@ -18,6 +18,20 @@ class CertificateStore {
$this->root = rtrim(str_replace("\\", "/", $root), "/");
}
public function get($name) {
return \Amp\resolve($this->doGet($name));
}
private function doGet($name) {
Assert::string($name, "Name must be a string. Got: %s");
try {
return yield \Amp\File\get($this->root . "/" . $name . "/cert.pem");
} catch (FilesystemException $e) {
throw new CertificateStoreException("Failed to load certificate.", 0, $e);
}
}
public function put(array $certificates) {
return \Amp\resolve($this->doPut($certificates));
}