我想实现这个目标:
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());
}
然后将其与new SunPKCS11(getTokenCfg());
答案 0 :(得分:-1)
奇怪的是,我只是冤枉了弦......
RSSS ....
以下"name = {0} \r\nlibrary = {1} \r\nslotListIndex = 0"
,就像魅力一样......
傻傻的我,我误认了换行线,忘记了马车返回的字符......