I want to achieve this:
private static InputStream getTokenCfg() {
String cfg = MessageFormat.format(
"name = {0} /n library = {1} /n slotListIndex = 0",
config.getPkcs11().getKey(),
config.getPkcs11().getValue());
return new ByteArrayInputStream(cfg.getBytes());
}
and then use it with new SunPKCS11(getTokenCfg());
Curiously enough, I just wronged the string...
rsss....
The following "name = {0} \r\nlibrary = {1} \r\nslotListIndex = 0"
, works like a charm..
Silly me, I mistook the newline and forgot the carriage-return char...