iotivity-lite icon indicating copy to clipboard operation
iotivity-lite copied to clipboard

Credential ID and Type always returns "0" and "Unknown" on Java/Linux

Open AntGarrido opened this issue 3 years ago • 1 comments

OCCred_credType_get returns 0 (Unknown), and OCCred_credId_get returns 0 for all credential types when used in Java/Linux. When used in Java/Android or C/Linux, however, they return proper codes and work as expected.

For Linux the compilation flags are: DEBUG=1 SECURE=1 IPV4=1 TCP=1 PKI=1 DYNAMIC=1 CLOUD=1 JAVA=1 IDD=1

AntGarrido avatar Sep 13 '21 10:09 AntGarrido

Using onboarding_tool (C), code 19 (Retrieve own creds), values are as expected:

credid: 1414584228
subjectuuid: *
credtype: Asymmetric signing key with certificate
credusage: oic.sec.cred.trustca
publicdata_encoding: oic.sec.encoding.pem
privatedata_encoding: Unknown

However, using java_onboarding_tool, returns this:

credid: 0 
subjectuuid: d0d52364-0800-0000-2a00-000000000000
credtype: Unknown 
credusage: None 
privatedata_encoding: Unknown

For all credentials, credid is always "0", credtype "Unknown", and credusage "None"

I've noticed the Makefile for swig has some SWIG_CFLAG missing:

ifeq ($(CLOUD),1)
	TCP=1
	EXTRA_FLAG += -DOC_CLOUD
	SWIG_CFLAG += -DOC_CLOUD
	CLOUD_OBJ_DIR = $(PORT_OBJ_DIR)cloud/*.o
endif

ifneq ($(SECURE),0)
	EXTRA_FLAG += -DOC_SECURITY
	SWIG_CFLAG += -DOC_SECURITY
endif

ifeq ($(IDD), 1)
	EXTRA_FLAG += -DOC_IDD_API
	SWIG_CFLAG += -DOC_IDD_API
endif

ifneq ($(PKI),0)
	EXTRA_FLAG += -DOC_PKI
	SWIG_CFLAG += -DOC_PKI
endif

With these changes, I'm able to see now the correct credusage values

credid: 0
subjectuuid: d0d52364-0800-0000-2a00-000000000000
credtype: Unknown
credusage: oic.sec.cred.trustca
publicdata_encoding: oic.sec.encoding.pem
privatedata_encoding: Unknown

But credid and credtype still return 0 and Unknown

AntGarrido avatar Sep 24 '21 12:09 AntGarrido