Discard the encoded byte array. On JavaCard, AFAIR does not have the ability to decode it directly - you need to install different key components separately.
For example, RSAPrivateKey needs to be initialized with a metric and module:
rsaPrivate = (RSAPrivateKey) javacard.security.KeyBuilder.buildKey (javacard.security.KeyBuilder.TYPE_RSA_PRIVATE, javacard.security.KeyBuilder.LENGTH_RSA_512, false); byte[] exponent = {(byte) 7}; byte[] modulus = {(byte) 33}; rsaPrivate.setExponent(exponent, (short) 0, (short) exponent.length); rsaPrivate.setModulus(modulus, (short) 0, (short) modulus.length);
BTW: For JavaCard questions, I recommend the JavaCard Forum on Oracle forums. If you are looking for RSAPrivateKey, you will find interesting posts.
Robert
source share