PKCS#11 structure:
typedef struct CK_INFO { CK_VERSION cryptokiVersion; CK_UTF8CHAR manufacturerID[32]; CK_FLAGS flags; CK_UTF8CHAR libraryDescription[32]; CK_VERSION libraryVersion; } CK_INFO;
593594595596597598599600601602603
final InputStream config = new ByteArrayInputStream( new StringBuilder().append("name=").append(name).append("\n") .append("library=").append(library) .toString().getBytes()); Provider provider = new SunPKCS11(config); Security.addProvider(provider); final KeyStore.Builder builder = KeyStore.Builder.newInstance("PKCS11", provider, callbackHandlerProtection);
3233343536373839404142
public class ProviderLoader { public static void go(final String config) throws Exception { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { SunPKCS11 provider = new SunPKCS11(config); Security.addProvider(provider); return null; } }); }
739740741742743744745746747748749
} } private void parseAttributes(String keyword) throws IOException { if (templateManager == null) { templateManager = new TemplateManager(); } int token = nextToken(); if (token == '=') { String s = parseWord(); if (s.equals("compatibility") == false) {