diff --git a/src/pEp.yml2 b/src/pEp.yml2 index dd1b14d..ca4533a 100644 --- a/src/pEp.yml2 +++ b/src/pEp.yml2 @@ -250,6 +250,15 @@ namespace pEp { in CipherSuite suite ); + method config_passphrase( + in string passphrase + ); + + method config_passphrase_for_new_keys( + in bool enable, + in string passphrase + ); + // "basic" methods are generated on the java side, but // on the C++ side, manually implemented in basic_api.cc diff --git a/test/java/foundation/pEp/jniadapter/test/jni111/Makefile b/test/java/foundation/pEp/jniadapter/test/jni111/Makefile new file mode 100644 index 0000000..542cbb0 --- /dev/null +++ b/test/java/foundation/pEp/jniadapter/test/jni111/Makefile @@ -0,0 +1,37 @@ +include ../../../../../../../Makefile.conf +include ../Makefile.conf + +TEST_UNIT_NAME=jni111 + +JAVA_CLASSES = \ + TestAlice.class \ + ../utils/AdapterBaseTestContext.class \ + ../utils/AdapterTestUtils.class \ + ../utils/TestCallbacks.class + +.PHONY: pitytest compile alice test clean + +all: alice compile + +pitytest: + $(MAKE) -C $(PITYTEST_DIR) + +alice: compile clean-pep-home-alice + cd $(JAVA_CWD);pwd;HOME=$(JAVA_PEP_HOME_DIR_ALICE) $(JAVA) $(JAVA_PKG_BASENAME).$(TEST_UNIT_NAME).TestAlice + +compile: $(JAVA_CLASSES) pitytest + +%.class: %.java + cd $(JAVA_CWD);javac -cp $(CLASSPATH) $(JAVA_PKG_BASEPATH)/$(TEST_UNIT_NAME)/$< + +clean: + rm -f $(JAVA_CLASSES) + rm -f *.class + rm -f *.log + rm -Rf .gnupg + rm -Rf .lldb + +clean-pep-home: clean-pep-home-alice + +clean-pep-home-alice: + rm -rf $(PEP_HOME_DIR_ALICE)/.pEp diff --git a/test/java/foundation/pEp/jniadapter/test/jni111/TestAlice.java b/test/java/foundation/pEp/jniadapter/test/jni111/TestAlice.java new file mode 100644 index 0000000..2bf50db --- /dev/null +++ b/test/java/foundation/pEp/jniadapter/test/jni111/TestAlice.java @@ -0,0 +1,25 @@ +package foundation.pEp.jniadapter.test.jni111; +import static foundation.pEp.pitytest.TestLogger.*; +import foundation.pEp.pitytest.*; +import foundation.pEp.pitytest.utils.TestUtils; +import foundation.pEp.jniadapter.test.utils.*; + + +// https://pep.foundation/jira/browse/JNI-111 + +class TestAlice { + public static void main(String[] args) throws Exception { + TestSuite.getDefault().setVerbose(true); + TestSuite.getDefault().setTestColor(TestUtils.TermColor.GREEN); + + new TestUnit("config_passphrase",new AdapterBaseTestContext() , ctx -> { + ctx.engine.config_passphrase("SUPERCOMPLICATEDPASSPHRASE"); + }); + + new TestUnit("config_passphrase_for_new_keys",new AdapterBaseTestContext() , ctx -> { + ctx.engine.config_passphrase_for_new_keys(true, "SUPERCOMPLICATEDPASSPHRASE"); + }); + + TestSuite.getDefault().run(); + } +} \ No newline at end of file diff --git a/test/java/foundation/pEp/jniadapter/test/regression/TestMain.java b/test/java/foundation/pEp/jniadapter/test/regression/TestMain.java index f48b501..cbaceb9 100644 --- a/test/java/foundation/pEp/jniadapter/test/regression/TestMain.java +++ b/test/java/foundation/pEp/jniadapter/test/regression/TestMain.java @@ -260,6 +260,15 @@ class TestMain { ctx.engine.isSyncRunning(); }); + new TestUnit("Engine.config_passphrase",new RegTestContext() , ctx -> { + ctx.engine.config_passphrase("SUPERCOMPLICATEDPASSPHRASE"); + }); + + new TestUnit("Engine.config_passphrase_for_new_keys",new RegTestContext() , ctx -> { + ctx.engine.config_passphrase_for_new_keys(true, "SUPERCOMPLICATEDPASSPHRASE"); + }); + + TestSuite.getDefault().run(); } }