@@ -890,7 +890,9 @@ CardTransactionManager prepareDecreaseCounters(
890890 *
891891 * @return The current instance.
892892 * @since 1.0.0
893+ * @deprecated Use {@link #processCommands(boolean)} method instead.
893894 */
895+ @ Deprecated
894896 CardTransactionManager prepareReleaseCardChannel ();
895897
896898 /**
@@ -1030,9 +1032,33 @@ CardTransactionManager prepareDecreaseCounters(
10301032 * @throws UnexpectedCommandStatusException If a command returns an unexpected status.
10311033 * @throws InconsistentDataException If inconsistent data have been detected.
10321034 * @since 1.0.0
1035+ * @deprecated Use {@link #prepareVerifyPin(byte[])} method instead.
10331036 */
1037+ @ Deprecated
10341038 CardTransactionManager processVerifyPin (byte [] pin );
10351039
1040+ /**
1041+ * Schedules the execution of a PIN verification command in order to authenticate the cardholder
1042+ * and/or unlock access to certain card files.
1043+ *
1044+ * <p>This command can be performed both in and out of a secure session. The PIN code can be
1045+ * transmitted in plain text or encrypted according to the parameter set in {@link
1046+ * CardSecuritySetting}. By default, the transmission is encrypted.
1047+ *
1048+ * <p>If the execution is done out of session but an encrypted transmission is requested, then
1049+ * CardTransactionManager must be constructed with {@link CardSecuritySetting}.
1050+ *
1051+ * <p>If CardTransactionManager is constructed without {@link CardSecuritySetting} the
1052+ * transmission in done in plain.
1053+ *
1054+ * @param pin The PIN code value (4-byte long byte array).
1055+ * @return The current instance.
1056+ * @throws UnsupportedOperationException If the PIN feature is not available for this card.
1057+ * @throws IllegalArgumentException If the provided argument is out of range.
1058+ * @since 1.6.0
1059+ */
1060+ CardTransactionManager prepareVerifyPin (byte [] pin );
1061+
10361062 /**
10371063 * Replaces the current PIN with the new value provided.
10381064 *
@@ -1054,9 +1080,31 @@ CardTransactionManager prepareDecreaseCounters(
10541080 * @throws UnexpectedCommandStatusException If a command returns an unexpected status.
10551081 * @throws InconsistentDataException If inconsistent data have been detected.
10561082 * @since 1.0.0
1083+ * @deprecated Use {@link #prepareChangePin(byte[])} method instead.
10571084 */
1085+ @ Deprecated
10581086 CardTransactionManager processChangePin (byte [] newPin );
10591087
1088+ /**
1089+ * Schedules the execution of a PIN modification command to replace the current PIN with the new
1090+ * value provided.
1091+ *
1092+ * <p>This command can be performed only out of a secure session. The new PIN code can be
1093+ * transmitted in plain text or encrypted according to the parameter set in {@link
1094+ * CardSecuritySetting}. By default, the transmission is encrypted.
1095+ *
1096+ * <p>When the PIN is transmitted plain, this command must be preceded by a successful Verify PIN
1097+ * command (see {@link #prepareVerifyPin(byte[])}).
1098+ *
1099+ * @param newPin The new PIN code value (4-byte long byte array).
1100+ * @return The current instance.
1101+ * @throws UnsupportedOperationException If the PIN feature is not available for this card.
1102+ * @throws IllegalArgumentException If the provided argument is out of range.
1103+ * @throws IllegalStateException If the command is executed while a secure session is open.
1104+ * @since 1.6.0
1105+ */
1106+ CardTransactionManager prepareChangePin (byte [] newPin );
1107+
10601108 /**
10611109 * Replaces one of the current card keys with another key present in the SAM.
10621110 *
@@ -1082,20 +1130,49 @@ CardTransactionManager prepareDecreaseCounters(
10821130 * @throws UnexpectedCommandStatusException If a command returns an unexpected status.
10831131 * @throws InconsistentDataException If inconsistent data have been detected.
10841132 * @since 1.1.0
1133+ * @deprecated Use {@link #prepareChangeKey(int, byte, byte, byte, byte)} method instead.
10851134 */
1135+ @ Deprecated
10861136 CardTransactionManager processChangeKey (
10871137 int keyIndex , byte newKif , byte newKvc , byte issuerKif , byte issuerKvc );
10881138
1139+ /**
1140+ * Schedules the execution of a key loading command to replace one of the current card keys with
1141+ * another key present in the SAM.
1142+ *
1143+ * <p>This command can be performed only out of a secure session.
1144+ *
1145+ * <p>The change key process transfers the key from the SAM to the card. The new key is
1146+ * diversified by the SAM from a primary key and encrypted using the indicated issuer key to
1147+ * secure the transfer to the card. All provided KIFs and KVCs must be present in the SAM.
1148+ *
1149+ * @param keyIndex The index of the key to be replaced (1 for the issuer key, 2 for the load key,
1150+ * 3 for the debit key).
1151+ * @param newKif The KIF of the new key.
1152+ * @param newKvc The KVC of the new key.
1153+ * @param issuerKif The KIF of the current card's issuer key.
1154+ * @param issuerKvc The KVC of the current card's issuer key.
1155+ * @return The current instance.
1156+ * @throws UnsupportedOperationException If the Change Key command is not available for this card.
1157+ * @throws IllegalArgumentException If the provided key index is out of range.
1158+ * @throws IllegalStateException If the command is executed while a secure session is open.
1159+ * @since 1.6.0
1160+ */
1161+ CardTransactionManager prepareChangeKey (
1162+ int keyIndex , byte newKif , byte newKvc , byte issuerKif , byte issuerKvc );
1163+
10891164 /**
10901165 * Opens a Calypso Secure Session and then executes all previously prepared commands.
10911166 *
10921167 * <p>It is the starting point of the sequence:
10931168 *
10941169 * <ul>
10951170 * <li>{@code processOpening(WriteAccessLevel)}
1096- * <li>[{@link #processCardCommands()}]
10971171 * <li>[...]
1098- * <li>[{@link #processCardCommands()}]
1172+ * <li>[{@link #processCommands()}]
1173+ * <li>[...]
1174+ * <li>[{@link #processCommands()}]
1175+ * <li>[...]
10991176 * <li>{@link #processClosing()}
11001177 * </ul>
11011178 *
@@ -1142,14 +1219,6 @@ CardTransactionManager processChangeKey(
11421219 * <li>Receiving grouped responses and updating {@link CalypsoCard} with the collected data.
11431220 * </ul>
11441221 *
1145- * For optimization purposes, if the first command prepared is the reading of a single record of a
1146- * card file then this one is replaced by a setting of the session opening command allowing the
1147- * retrieval of this data in response to this command.
1148- *
1149- * <p>Please note that the CAAD mechanism may require a file to be read before being modified. For
1150- * this mechanism to work properly, this reading must not be placed in the first position of the
1151- * prepared commands in order to be correctly taken into account by the SAM.
1152- *
11531222 * <p><b>Other operations carried out</b>
11541223 *
11551224 * <ul>
@@ -1191,9 +1260,40 @@ CardTransactionManager processChangeKey(
11911260 * @throws SelectFileException If a "Select File" prepared card command indicated that the file
11921261 * was not found.
11931262 * @since 1.0.0
1263+ * @deprecated Use {@link #prepareOpenSecureSession(WriteAccessLevel)} method instead.
11941264 */
1265+ @ Deprecated
11951266 CardTransactionManager processOpening (WriteAccessLevel writeAccessLevel );
11961267
1268+ /**
1269+ * Schedules the execution of a secure session opening command.
1270+ *
1271+ * <p>This feature is only available for a transaction initialized in secure mode.
1272+ *
1273+ * <p>The secure session will be opened with the provided {@link WriteAccessLevel} depending on
1274+ * whether it is a personalization, reload or debit transaction profile.
1275+ *
1276+ * <p>Note that if the next prepared command is a "Read One Record" or "Read One Or More
1277+ * Counters", then it will by default be merged with the "Open Secure Session" command for
1278+ * optimization purposes.
1279+ *
1280+ * <p>This mechanism may in some cases be incompatible with the security constraints and can be
1281+ * disabled via the {@link CardSecuritySetting#disableReadOnSessionOpening()} method.
1282+ *
1283+ * @param writeAccessLevel The write access level to be used.
1284+ * @return The current instance.
1285+ * @throws IllegalArgumentException If the provided argument is null.
1286+ * @throws IllegalStateException In the following cases:
1287+ * <ul>
1288+ * <li>No {@link CardSecuritySetting} is available
1289+ * <li>A secure session opening is already prepared
1290+ * <li>A secure session is already opened
1291+ * </ul>
1292+ *
1293+ * @since 1.6.0
1294+ */
1295+ CardTransactionManager prepareOpenSecureSession (WriteAccessLevel writeAccessLevel );
1296+
11971297 /**
11981298 * Terminates the Secure Session sequence started with {@link #processOpening(WriteAccessLevel)}.
11991299 *
@@ -1257,9 +1357,32 @@ CardTransactionManager processChangeKey(
12571357 * @throws InvalidCardSignatureException If session is correctly closed but the card signature is
12581358 * incorrect.
12591359 * @since 1.0.0
1360+ * @deprecated Use {@link #prepareCloseSecureSession()} method instead.
12601361 */
1362+ @ Deprecated
12611363 CardTransactionManager processClosing ();
12621364
1365+ /**
1366+ * Schedules the execution of a secure session closing command.
1367+ *
1368+ * <p>The ratification mechanism is disabled by default but can be enabled via the {@link
1369+ * CardSecuritySetting#enableRatificationMechanism()} method.
1370+ *
1371+ * <p>In this case, a ratification command is added after the "Close Secure Session" command when
1372+ * the communication is done in contactless mode.
1373+ *
1374+ * @return The current instance.
1375+ * @throws IllegalStateException In the following cases:
1376+ * <ul>
1377+ * <li>No secure session is opened and no secure session opening is prepared
1378+ * <li>A secure session closing is already prepared
1379+ * <li>A secure session canceling is prepared
1380+ * </ul>
1381+ *
1382+ * @since 1.6.0
1383+ */
1384+ CardTransactionManager prepareCloseSecureSession ();
1385+
12631386 /**
12641387 * Aborts a Secure Session.
12651388 *
@@ -1273,6 +1396,18 @@ CardTransactionManager processChangeKey(
12731396 * @throws CardIOException If a communication error with the card occurs.
12741397 * @throws UnexpectedCommandStatusException If the command returns an unexpected status.
12751398 * @since 1.0.0
1399+ * @deprecated Use {@link #prepareCancelSecureSession()} method instead.
12761400 */
1401+ @ Deprecated
12771402 CardTransactionManager processCancel ();
1403+
1404+ /**
1405+ * Schedules the execution of a secure session canceling command.
1406+ *
1407+ * <p>This command will be executed in safe mode and will not raise any exceptions.
1408+ *
1409+ * @return The current instance.
1410+ * @since 1.6.0
1411+ */
1412+ CardTransactionManager prepareCancelSecureSession ();
12781413}
0 commit comments