Class SecurityFrameworkUtil
java.lang.Object
org.jetbrains.nativecerts.mac.SecurityFrameworkUtil
Get trusted certificates stored in corresponding keychains via Security frameworks APIs.
for the other implementations, see root_cgo_darwin.go in Go and trust_store_mac.cc in Chromium
In the future it would be better to implement
Native objects are opaque pointers (
In the future it would be better to implement
X509TrustManager on SecTrustEvaluateWithError instead
of getting the trust chain manually. It's not yet investigated whether it is possible at all to integrate it into
the SSL framework of JVM.
Native objects are opaque pointers (
MemorySegment); see SecurityFramework and
CoreFoundationExt for the bindings and CoreFoundationExtUtil for type-checked accessors.-
Method Summary
Modifier and TypeMethodDescriptionstatic List<X509Certificate> Get trusted roots backed into macOS (system domain)static @NotNull List<X509Certificate> getTrustedCertificates(boolean systemDomain) Enumerates certificates viaSecItemCopyMatching.static List<X509Certificate> Get trusted roots installed on admin and user level (domain)static booleanisTrustedRoot(@NotNull MemorySegment certificateRef) Decides whether a certificate from the user/admin keychains is a trusted root for our purposes: either it has explicit trust settings that we understand and that say "trust as root for SSL", or it has no trust settings and the Security framework validates it against the trusted roots.
-
Method Details
-
getTrustedRoots
Get trusted roots installed on admin and user level (domain) -
getSystemTrustedRoots
Get trusted roots backed into macOS (system domain) -
getTrustedCertificates
Enumerates certificates viaSecItemCopyMatching.- Parameters:
systemDomain- true: certificates from the immutable system roots keychain (all implicitly trusted); false: certificates from the default keychain search list (login + System keychains), filtered byisTrustedRoot(MemorySegment)
-
isTrustedRoot
Decides whether a certificate from the user/admin keychains is a trusted root for our purposes: either it has explicit trust settings that we understand and that say "trust as root for SSL", or it has no trust settings and the Security framework validates it against the trusted roots.- Parameters:
certificateRef- SecCertificateRef (borrowed)
-