Getting the Initial PIN from a Device
To get the initial PIN, complete the following steps:
-
Get the SecurityModule:
CopySecurityModule smo = smMgr.getSecurityModule(smId);
-
Get the credentials for the SecurityModule:
CopyCredential[] creds = smo.getCredentials();
-
Find the PIN credential.
Note: The CCM constant associated with the PIN credential element is CRED_ID_TYPE_PIN.Copyfor (int i = 0; i < creds.length; i++){
if (creds[i].getType().equals(CCMConstants. CRED_ID_TYPE_PIN){
// 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_PIN){
return credEls[j].getValue();
}