简体   繁体   English

使用来自 ByteArrayInputStream 的配置实例化 SunPKCS11

[英]Instantianting a SunPKCS11 with a config from a ByteArrayInputStream

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());然后将其与new SunPKCS11(getTokenCfg());一起使用

Curiously enough, I just wronged the string...奇怪的是,我只是委屈了字符串......
rsss.... 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...下面的"name = {0} \r\nlibrary = {1} \r\nslotListIndex = 0" ,就像一个魅力......愚蠢的我,我误认为换行符并忘记了回车符......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM