Getting the VCI Pairing Code from a Device
To get the VCI Pairing Code, complete the following steps:
-
Get the SecurityModule:
CopySecurityModule smo = smMgr.getSecurityModule(smId);
-
Get the credentials for the SecurityModule:
CopyCredential[] creds = smo.getCredentials();
-
Find the VCI credential.
Note: The CCM constant associated with the VCI credential element is CRED_ID_TYPE_VCI. -
Find the Pairing Code element in the credential.
Note: Note: The CCM constant associated with the pairing code credential element is CRED_ELEMENT_ID_VCI_PAIRING_CODE.Copyfor (int i = 0; i < creds.length; i++){
if (creds[i].getType().equals(CCMConstants.CRED_ID_TYPE_VCI){
// Get the set of credential elements for each credential:
CredentialElement[] credEls = cred[i].getCredentialElements();
// Iterate through credential elements looking for initial PIN
for (int j = 0; j < credEls.length; i++){
if(credEls[j].getType().equals(CCMConstants.CRED_ELEMENT_ID_VCI_PAIRING_CODE){
return credEls[j].getValue();
}