Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I suggest you to use java-applet. This approach is unified for all browsers. We use it in our projects. To sign the user-data you will need to use JCA API (<a href="http://download.oracle.com/javase/1.4.2/docs/guide/security/CryptoSpec.html#Signature">http://download.oracle.com/javase/1.4.2/docs/guide/security/CryptoSpec.html#Signature</a>). Also you will need to solve problem with accessing windows certificate store from java. </p> <p>You can solve it in this way:</p> <pre><code>KeyStore keystore = KeyStore.getInstance("Windows-MY", "SunMSCAPI"); keystore.load(null, null); HashMap&lt;String,String&gt; userPublicKeys = new HashMap&lt;String,String&gt;(); Enumeration&lt;String&gt; aliasesEnum = keystore.aliases(); if (!aliasesEnum.hasMoreElements()) throw new Exception("No certificate!"); // list through windows personal store while (aliasesEnum.hasMoreElements()) { String alias = aliasesEnum.nextElement(); boolean isKey = keystore.isKeyEntry(alias); if (isKey) { BASE64Encoder encoder = new BASE64Encoder(); encoder.encode(keystore.getCertificate(alias).getEncoded()); userPublicKeys.put(alias, encoder.encode(keystore.getCertificate(alias).getEncoded())); System.out.println("Entry alias: " + alias); } // sign PrivateKey privateKey = (PrivateKey) keystore.getKey(alias,null); Provider provider = keystore.getProvider(); // data to signed byte[] data ="test data".getBytes(); // Signing the data Signature sig = Signature.getInstance("SHA1withRSA", provider); sig.initSign(privateKey); sig.update(data); byte[] signature = sig.sign(); System.out.println(ByteArrayToFromHexDigits.bytesToHexString(signature).toUpperCase()); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload