简体   繁体   中英

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());

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...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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