X.509 certificates can include key usage fields (KU) and advanced key usage fields (EKU). An Oracle technical note describing how to create your RIA badge creates a certificate without any key usage flags, which works just fine (if you can get a trusted CA to sign it)
But more and more CAs issue certificates with these key usage fields. If present, these fields restrict the use of the certificate. The java plugin checks for these fields in EndEntityChecker :
private void checkCodeSigning(X509Certificate cert) throws CertificateException { Set<String> exts = getCriticalExtensions(cert); if (checkKeyUsage(cert, KU_SIGNATURE) == false) { throw new ValidatorException ("KeyUsage does not allow digital signatures", ValidatorException.T_EE_EXTENSIONS, cert); } if (checkEKU(cert, exts, OID_EKU_CODE_SIGNING) == false) { throw new ValidatorException ("Extended key usage does not permit use for code signing", ValidatorException.T_EE_EXTENSIONS, cert); } if (!SimpleValidator.getNetscapeCertTypeBit(cert, NSCT_SSL_CLIENT)) { throw new ValidatorException ("Netscape cert type does not permit use for SSL client", ValidatorException.T_EE_EXTENSIONS, cert); }
Verification methods are as follows:
private boolean checkEKU(X509Certificate cert, Set<String> exts, String expectedEKU) throws CertificateException { List<String> eku = cert.getExtendedKeyUsage(); if (eku == null) { return true; } return eku.contains(expectedEKU) || eku.contains(OID_EKU_ANY_USAGE); }
So, if KU or EKU is not specified, checking KU or EKU will happily return true.
But
- If KU is specified, the KU digital signature must be one of them.
- if any EKUs are specified, either the signing of the EKU code (identified by oid 1.3.6.1.5.5.7.3.3) or any use of the EKU (identified by oid 2.5.29.37.0) must also be indicated.
Finally, the checkRemainingExtensions method checks the remaining critical EKUs. The only other critical ECU allowed to attend is
- main restrictions (oid "2.5.29.19") and
- subject alt name (oid 2.5.29.17)
If it finds any other critical ECU, it returns false.
flup Dec 28 '14 at 13:17 2014-12-28 13:17
source share