Available on Android only.
Expand description
On Android, initialization must be done before any verification is attempted.
Some manual setup is required outside of cargo to use this crate on Android. In order to use
Android’s certificate verifier, the crate needs to call into the JVM. A small Kotlin component
must be included in your app’s build to support rustls-platform-verifier.
See the crate’s Android section for more details.
§Examples
// A typical entrypoint signature for obtaining the necessary pointers
pub fn android_init(raw_env: *mut c_void, raw_context: *mut c_void) -> Result<(), jni::errors::Error> {
let mut env = unsafe { JNIEnv::from_raw(raw_env as *mut jni::sys::JNIEnv).unwrap() };
let context = unsafe { JObject::from_raw(raw_context as jni::sys::jobject) };
rustls_platform_verifier::android::init_with_env(&mut env, context)?;
}
Traits§
- Runtime
- A layer to access the Android runtime which is hosting the current application process.
Functions§
- init_
external - Deprecated: This is the original method name for
init_with_runtime
and is functionally identical. - init_
hosted - Deprecated: This is the original method name for
init_with_env
and is functionally identical. - init_
with_ env - Initialize given a typical Android NDK
JNIEnv
andJObject
context. - init_
with_ refs - Initialize with references to the JVM, context, and class loader.
- init_
with_ runtime - Initialize with a runtime that can dynamically serve references to the JVM, context, and class loader.