簡體   English   中英

使用來自 ByteArrayInputStream 的配置實例化 SunPKCS11

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

我想實現這個:

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());一起使用

奇怪的是,我只是委屈了字符串......
RSSS....
下面的"name = {0} \r\nlibrary = {1} \r\nslotListIndex = 0" ,就像一個魅力......愚蠢的我,我誤認為換行符並忘記了回車符......

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM