Instantianting a SunPKCS11 with a config from a ByteArrayInputStream

Go To StackoverFlow.com

0

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

2012-04-04 20:56
by marcelo-ferraz


-1

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

2012-04-05 13:20
by marcelo-ferraz
No. You wrote a forward slash instead of a backslash. The carriage return isn't required - user207421 2015-11-08 03:59
Ads