Getting the VCI Pairing Code from a Device

To get the VCI Pairing Code, complete the following steps:

  1. Get the SecurityModule:

    Copy
    SecurityModule smo = smMgr.getSecurityModule(smId);
  2. Get the credentials for the SecurityModule:

    Copy
    Credential[] creds = smo.getCredentials();
  3. Find the VCI credential.

    Note: The CCM constant associated with the VCI credential element is CRED_ID_TYPE_VCI.
  4. 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.
    Copy
    for (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();
    }