Send a random number to host
Posted: Wed Jan 11, 2017 10:56 pm
				
				I want to send  a random number to a host. Now my problem is how to create APDU answer. anyone  can help?
			Code: Select all
    private void sendChallenge(APDU apdu){
    byte[] apduBuffer = apdu.getBuffer();
    apdu.setOutgoing();
    try {
     
      SecureRandom prng = SecureRandom.getInstance("SHA1PRNG");
      String randomNum = new Integer( prng.nextInt() ).toString();
      byte[] randomBytes = randomNum.getBytes();
     
   /* I want to send the number here */
    }
    catch ( NoSuchAlgorithmException ex ) {
      System.err.println(ex);
    }
    }