How to sign a digest generated by signtool /dg #199
-
I have a question that is similar to #171 and #176. I have a REST API that provides a centralised code signing service. I'd like to migrate the server side to JSign rather than signtool to avoid HSM PIN entry. At present, the API can do two things:
Is there a way that I can use JSign to achieve the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Implementing If your REST API is in Java you can also use the Jsign API instead of the command line tool. You can use the JCA provider with the standard Java crypto classes like this: Provider provider = new JsignJcaProvider();
KeyStore keystore = KeyStore.getInstance(YUBIKEY.name(), provider);
keystore.load(null, accessToken);
PrivateKey key = (PrivateKey) keystore.getKey(alias, null);
Signature signature = Signature.getInstance("SHA256withRSA", provider);
signature.initSign(key);
signature.update(message.getBytes());
signature.sign(); That said, did you consider using Jsign on the client side. By implementing a SigningService Jsign could call directly your REST API. |
Beta Was this translation helpful? Give feedback.
Implementing
.dig
signing shouldn't be difficult, you just have to implement theSignable
interface and add aSignableProvider
for.dig
files. That's a bit a degenerated case because the file doesn't really contain the signature, and the signature isn't a full PKCS7 message, but that could work.If your REST API is in Java you can also use the Jsign API instead of the command line tool. You can use the JCA provider with the standard Java crypto classes like this: