"\nSerial Number: ", serialNumber, "\nFlags: 0x", Util.toFullHex(flags), "\nRandom Number Generator: ", isRNG(), "\nWrite protected: ", isWriteProtected(), "\nLogin required: ", isLoginRequired(), "\nUser PIN initialized: ", isUserPinInitialized(), "\nRestore Key not needed: ", isRestoreKeyNotNeeded(), "\nClock on Token: ", isClockOnToken(), "\nProtected Authentication Path: ", isProtectedAuthenticationPath(), "\nDual Crypto Operations: ", isDualCryptoOperations(), "\nToken initialized: ", isTokenInitialized(), "\nSecondary Authentication: ", isSecondaryAuthentication(), "\nUser PIN-Count low: ", isUserPinCountLow(), "\nUser PIN final Try: ", isUserPinFinalTry(), "\nUser PIN locked: ", isUserPinLocked(), "\nUser PIN to be changed: ", isUserPinToBeChanged(), "\nSecurity Officer PIN-Count low: ", isSoPinCountLow(), "\nSecurity Officer PIN final Try: ", isSoPinFinalTry(), "\nSecurity Officer PIN locked: ", isSoPinLocked(), "\nSecurity Officer PIN to be changed: ", isSoPinToBeChanged(), "\nMaximum Session Count: ", maxCountToString(maxSessionCount), "\nSession Count: ", countToString(sessionCount), "\nMaximum Read/Write Session Count: ", maxCountToString(maxRwSessionCount), "\nRead/Write Session Count: ", countToString(rwSessionCount), "\nMaximum PIN Length: ", maxPinLen, "\nMinimum PIN Length: ", minPinLen, "\nTotal Public Memory: ", countToString(totalPrivateMemory), "\nFree Public Memory: ", countToString(freePublicMemory),
private void firstLogin(Session session, List<char[]> password) throws P11TokenException { try { boolean isProtectedAuthenticationPath = session.getToken().getTokenInfo().isProtectedAuthenticationPath(); if (isProtectedAuthenticationPath || CollectionUtil.isEmpty(password)) { LOG.info("verify on PKCS11Module with PROTECTED_AUTHENTICATION_PATH"); singleLogin(session, null); } else { LOG.info("verify on PKCS11Module with PIN"); for (char[] singlePwd : password) { singleLogin(session, singlePwd); } this.password = password; } } catch (PKCS11Exception ex) { // 0x100: user already logged in if (ex.getErrorCode() != 0x100) { throw new P11TokenException(ex.getMessage(), ex); } } catch (TokenException ex) { throw new P11TokenException(ex.getMessage(), ex); } }
private void login(final Session session) throws P11TokenException { boolean isSessionLoggedIn = checkSessionLoggedIn(session); if (isSessionLoggedIn) { return; } boolean loginRequired; try { loginRequired = session.getToken().getTokenInfo().isLoginRequired(); } catch (TokenException ex) { LogUtil.error(LOG, ex, "could not check whether LoginRequired of token"); loginRequired = true; } LOG.debug("loginRequired: {}", loginRequired); if (!loginRequired) { return; } if (CollectionUtil.isEmpty(password)) { singleLogin(session, null); } else { for (char[] singlePwd : password) { singleLogin(session, singlePwd); } } }
maxSessionCount2 = token.getTokenInfo().getMaxSessionCount(); } catch (TokenException ex) { throw new P11TokenException("could not get tokenInfo: " + ex.getMessage(), ex);
/** * Get information about this token. * * @return An object containing information about this token. * @exception TokenException * If reading the information fails. * @preconditions * @postconditions (result <> null) */ public TokenInfo getTokenInfo() throws TokenException { CK_TOKEN_INFO ckTokenInfo; try { ckTokenInfo = slot.getModule().getPKCS11Module() .C_GetTokenInfo(slot.getSlotID()); } catch (sun.security.pkcs11.wrapper.PKCS11Exception ex) { throw new PKCS11Exception(ex); } return new TokenInfo(ckTokenInfo); }
private void firstLogin(final Session session, final List<char[]> password) throws P11TokenException { try { boolean isProtectedAuthenticationPath = session.getToken().getTokenInfo().isProtectedAuthenticationPath(); if (isProtectedAuthenticationPath || CollectionUtil.isEmpty(password)) { LOG.info("verify on PKCS11Module with PROTECTED_AUTHENTICATION_PATH"); singleLogin(session, null); } else { LOG.info("verify on PKCS11Module with PIN"); for (char[] singlePwd : password) { singleLogin(session, singlePwd); } this.password = password; } } catch (PKCS11Exception ex) { // 0x100: user already logged in if (ex.getErrorCode() != 0x100) { throw new P11TokenException(ex.getMessage(), ex); } } catch (TokenException ex) { throw new P11TokenException(ex.getMessage(), ex); } }
private void login(Session session) throws P11TokenException { boolean isSessionLoggedIn = checkSessionLoggedIn(session); if (isSessionLoggedIn) { return; } boolean loginRequired; try { loginRequired = session.getToken().getTokenInfo().isLoginRequired(); } catch (TokenException ex) { LogUtil.error(LOG, ex, "could not check whether LoginRequired of token"); loginRequired = true; } LOG.debug("loginRequired: {}", loginRequired); if (!loginRequired) { return; } if (CollectionUtil.isEmpty(password)) { singleLogin(session, null); } else { for (char[] singlePwd : password) { singleLogin(session, singlePwd); } } }
maxSessionCount2 = token.getTokenInfo().getMaxSessionCount(); } catch (TokenException ex) { throw new P11TokenException("could not get tokenInfo: " + ex.getMessage(), ex);