Improve error on a signature certificate with no or broken auth

This commit is contained in:
Sandro Santilli 2013-12-20 10:39:14 +01:00
parent b14830e4e3
commit c7465479a2

View File

@ -94,6 +94,14 @@ o.authorizedByCert = function(cert, auth) {
throw new Error("Unsupported certificate version " + cert.version);
}
if ( ! cert.auth ) {
throw new Error("No certificate authorization");
}
if ( ! cert.auth.method ) {
throw new Error("No certificate authorization method");
}
// Open authentication certificates are always authorized
if ( cert.auth.method === 'open' ) return true;