| Code with Finding: |
class PassportApduService {
/**
* Sends a <code>READ BINARY</code> command to the passport.
* Secure messaging will be applied to the command and response
* apdu.
*
* @param wrapper the secure messaging wrapper to use.
* @param offset offset into the file.
* @param le the expected length of the file to read.
*
* @return a byte array of length <code>le</code> with (part of)
* the contents of the currently selected file.
*/
public byte[] sendReadBinary(SecureMessagingWrapper wrapper, short offset,
int le) throws IOException {
Apdu capdu = createReadBinaryAPDU(offset, le);
if (wrapper != null) {
capdu.wrapWith(wrapper);
}
byte[] rapdu = sendAPDU(capdu);
if (wrapper != null) {
rapdu = wrapper.unwrap(rapdu, rapdu.length);
}
byte[] result = new byte[rapdu.length - 2];
System.arraycopy(rapdu, 0, result, 0, rapdu.length - 2);
return result;
}
}
|