What are the byte  buffer and what is offset? I do not get it! There are no arguments to those functions in standard java!
rsa_keys.genKeyPair(); // generate RSA key pair RSAPublicKey rsa_pu_key = (RSAPublicKey) rsa_keys.getPublic(); // extract Public key
890196 wrote:I was just trying to explain why the JC API is different to the Java API. It was nothing to do with how it should be used (one way or the other).
Yes but -
If you're just trying to retrieve the key info AND your APDU buffer size is greater than the size of your key info, you can write the key info directly into the APDU buffer - which is a RAM buffer which is there for you to use to return data.
If you've instead written the data out to an NVRAM array you can instead use the APDU.sendBytesLong() method to avoid the copy to the APDU buffer for output.I guess it depends on what you want to do with the key. You may want to DER encode the response to make it easy to use the key in the host application. You may also be embedding in a certificate. There are many use cases for this API, not just returning to the host.