X.509 인증서는 key usage fields (KU 's) 및 extended key usage fields (EKU 's)을 포함 할 수 있습니다. Oracle tech note describing how to create sign your RIA's은 중요한 사용 플래그가없는 인증서를 만듭니다. 신뢰할 수있는 CA로 서명 할 수있는 경우에만 작동합니다.
하지만 이러한 주요 사용 분야가있는 CA의 발행 인증서가 점점 더 많아지고 있습니다. 이 필드가있는 경우 은의 인증서 사용을 제한합니다. EndEntityChecker에서 이러한 필드의 존재에 대한 자바 플러그인 검사 :
/**
* Check whether this certificate can be used for code signing.
* @throws CertificateException if not.
*/
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);
}
// do not check Netscape cert type for JCE code signing checks
// (some certs were issued with incorrect extensions)
if (variant.equals(Validator.VAR_JCE_SIGNING) == false) {
if (!SimpleValidator.getNetscapeCertTypeBit(cert, NSCT_CODE_SIGNING)) {
throw new ValidatorException
("Netscape cert type does not permit use for code signing",
ValidatorException.T_EE_EXTENSIONS, cert);
}
exts.remove(SimpleValidator.OID_NETSCAPE_CERT_TYPE);
}
// remove extensions we checked
exts.remove(SimpleValidator.OID_KEY_USAGE);
exts.remove(SimpleValidator.OID_EXTENDED_KEY_USAGE);
checkRemainingExtensions(exts);
}
체크 방법으로 모양은 다음과 같습니다
/**
* Utility method checking if the extended key usage extension in
* certificate cert allows use for expectedEKU.
*/
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);
}
그래서 더 KU 또는 EKU가 지정되지 않은 경우 KU 또는 EKU 검사 행복하게 true를 반환합니다.
그러나
- KU의가 지정된 경우의 디지털 서명 KU 그들 중 하나 여야합니다.
어떤 EKU의이 지정된 경우
- , 중 (OID 1.3.6.1.5.5.7.3.3로 식별) 또는 EKU 에 서명 EKU 코드는 모든 사용은 (OID 2.5.29.37.0로 식별)를 지정해야합니다 게다가.
마지막으로 checkRemainingExtensions
메서드는 나머지 중요한 EKU를 검사합니다. 유일한 다른 중요한 EKU의 존재가 될 수 있습니다
- 기본 제약 (OID "2.5.29.19")와
- 주체 대체 이름 (OID 2.5.29.17)
하는 경우 다른 중요한 EKU를 찾으면 거짓을 반환합니다.
젠체하는 ... 나는 그들이 시장을 분류하고 더 많이 부담 할 수 있도록 그 깃발을 거기에 두는 것이 틀림 없다. – davr
정도. 보안에 도움이됩니다. –