Discussion:
[strongSwan-dev] using lib->creds->create for private key creation vs android_private_key_create
Ravi Kanth Vanapalli
2016-10-19 19:48:45 UTC
Permalink
Hi,
I am using EAP-TLS authentication.
Tried to load the private key using the function below

METHOD(charonservice_t, get_user_key, private_key_t*,
private_charonservice_t *this, public_key_t *pubkey)
{
private_key_t *key;
char path[512]="/system/etc/user1_private.der";
key = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
BUILD_FROM_FILE, path, BUILD_END);
if (!key) {
DBG1(DBG_DMN, "Parsing private key failed");
}
return key;
}


Is the call to this API equivalent to the call to the
API android_private_key_create() in file android_private_key.c

I understand that the second function gets the certificate via the JNI and
first function reads directly from the file.
The return type seems to the same, i.e private_key_t.

Can we treat these functions functionally equivalent ?
I am currently working in android and would like direct access to the
private key file instead of reading from the JNI.
--
Regards,
RaviKanth VN Vanapalli
Ravi Kanth Vanapalli
2016-10-19 20:08:30 UTC
Permalink
Also what is the role of the pubkey in the API below

android_private_key_create(jobject key, public_key_t *pubkey) ??

​how does the call to the API
lib->creds->create(lib->creds, CRED_PRIVATE_KEY, KEY_RSA, BUILD_FROM_FILE,
path, BUILD_END);
offset the role of the pubkey as described in the
android_private_key_create API ?

Thank you very much for your help.

Regards,
Ravikanth

Loading...