src/com/makina/security/OpenFIPS201/OpenFIPS201.java
private void processPIV_PUT_DATA(APDU apdu) {

        final byte CONST_P1 		= (byte)0x3F;
        final byte CONST_P2			= (byte)0xFF;
        final byte CONST_P2_ADMIN 	= (byte)0x00;

        byte[] buffer = apdu.getBuffer();
        short length = (short)(buffer[ISO7816.OFFSET_LC] & 0xFF);

        /*
         * PRE-CONDITIONS
         */

        // PRE-CONDITION 1 - The P1 value must be equal to the constant CONST_P1
        if (buffer[ISO7816.OFFSET_P1] != CONST_P1) {
            ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2);
        }

        // PRE-CONDITION 2 - The P2 value must be equal to the constant CONST_P2 or CONST_P2_ADMIN
        boolean admin = false;

        if (buffer[ISO7816.OFFSET_P2] == CONST_P2_ADMIN) {
            // This is an administrative command
            admin = true;
        } else if (buffer[ISO7816.OFFSET_P2] != CONST_P2) {
            ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2);
        }

        /*
         * EXECUTION STEPS
         */

        // STEP 1 - Call the applicable PIV 'PUT DATA' command
        if (admin) {
            piv.putDataAdmin(buffer, ISO7816.OFFSET_CDATA, length);
        } else {
            piv.putData(buffer, ISO7816.OFFSET_CDATA, length);
        }
    }
/**
     * Processes the PIV 'PUT DATA' command
     *
     * @param apdu The incoming APDU object
     */
Processes the PIV 'PUT DATA' command
@param apdu The incoming APDU object
Processes the PIV ' PUT DATA ' command @param apdu The incoming APDU object
private void processPIV_PUT_DATA(APDU apdu) {
        final byte CONST_P1 		= (byte)0x3F;
        final byte CONST_P2			= (byte)0xFF;
        final byte CONST_P2_ADMIN 	= (byte)0x00;
        byte[] buffer = apdu.getBuffer();
        short length = (short)(buffer[ISO7816.OFFSET_LC] & 0xFF);
        /*
         * PRE-CONDITIONS
         */
        if (buffer[ISO7816.OFFSET_P1] != CONST_P1) {
            ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2);
        }
        boolean admin = false;
        if (buffer[ISO7816.OFFSET_P2] == CONST_P2_ADMIN) {
            admin = true;
        } else if (buffer[ISO7816.OFFSET_P2] != CONST_P2) {
            ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2);
        }
        /*
         * EXECUTION STEPS
         */
        if (admin) {
            piv.putDataAdmin(buffer, ISO7816.OFFSET_CDATA, length);
        } else {
            piv.putData(buffer, ISO7816.OFFSET_CDATA, length);
        }
    }
private void processPIV_PUT_DATA ( APDU apdu ) { final byte CONST_P1 = ( byte ) 0x3F ; final byte CONST_P2 = ( byte ) 0xFF ; final byte CONST_P2_ADMIN = ( byte ) 0x00 ; byte [ ] buffer = apdu . getBuffer ( ) ; short length = ( short ) ( buffer [ ISO7816 . OFFSET_LC ] & 0xFF ) ; /*
         * PRE-CONDITIONS
         */ if ( buffer [ ISO7816 . OFFSET_P1 ] != CONST_P1 ) { ISOException . throwIt ( ISO7816 . SW_INCORRECT_P1P2 ) ; } boolean admin = false ; if ( buffer [ ISO7816 . OFFSET_P2 ] == CONST_P2_ADMIN ) { admin = true ; } else if ( buffer [ ISO7816 . OFFSET_P2 ] != CONST_P2 ) { ISOException . throwIt ( ISO7816 . SW_INCORRECT_P1P2 ) ; } /*
         * EXECUTION STEPS
         */ if ( admin ) { piv . putDataAdmin ( buffer , ISO7816 . OFFSET_CDATA , length ) ; } else { piv . putData ( buffer , ISO7816 . OFFSET_CDATA , length ) ; } }
Processes the PIV 'PUT DATA' command
 @param apdu The incoming APDU object
Processes the PIV ' PUT DATA ' command @param apdu The incoming APDU object
// PRE-CONDITION 1 - The P1 value must be equal to the constant CONST_P1 // PRE-CONDITION 2 - The P2 value must be equal to the constant CONST_P2 or CONST_P2_ADMIN // This is an administrative command // STEP 1 - Call the applicable PIV 'PUT DATA' command