private void extractNativeResource()

in sdk/host/src/main/java/org/apache/teaclave/javasdk/host/TeeSdkEnclave.java [46:68]


    private void extractNativeResource() throws EnclaveCreatingException {
        // Extract jni .so and signed tee .so from .jar file.
        // Only once extract and load operation.
        if (extractTempPath == null) {
            synchronized (TeeSdkEnclave.class) {
                if (extractTempPath == null) {
                    try {
                        String jniTempFilePath = ExtractLibrary.extractLibrary(
                                TeeSdkEnclave.class.getClassLoader(),
                                JNI_EXTRACTED_PACKAGE_PATH);
                        String teeSdkSignedFilePath = ExtractLibrary.extractLibrary(
                                TeeSdkEnclave.class.getClassLoader(),
                                TEE_SDK_SIGNED_PACKAGE_PATH);
                        extractTempPath = new TeeSdkExtractTempPath(jniTempFilePath, teeSdkSignedFilePath);
                        System.load(extractTempPath.getJniTempFilePath());
                        registerNatives();
                    } catch (IOException e) {
                        throw new EnclaveCreatingException("extracting tee sdk jni .so or signed .so failed.", e);
                    }
                }
            }
        }
    }