我想问一下使用Spring运行长进程的最佳方法是什么.我有一个webapp,当客户端发出请求时,它运行一个Spring控制器.该Controller将从请求中获取一些参数,然后运行查询并从数据库中获取记录.
来自DB的记录很高,我需要做一个可能需要很长时间的比较逻辑,所以我需要单独运行它.执行此过程时,应将最终结果写入excel文件并邮寄.
我的应用程序正在访问e-Token以解密来自服务器的响应
来自服务器的会话密钥使用以下方式加密: -
RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING
我正在使用SunPKCS11 Provider来实现对加密令牌的访问.每当我尝试使用上述机制解密时,即使用RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING,我得到: -
**javax.crypto.BadPaddingException: doFinal() failed
at sun.security.pkcs11.P11RSACipher.implDoFinal(P11RSACipher.java:328)
at sun.security.pkcs11.P11RSACipher.engineDoFinal(P11RSACipher.java:353)
at javax.crypto.Cipher.doFinal(DashoA13*..)
Run Code Online (Sandbox Code Playgroud)
以下是我的代码: -
private static final String TRANSFORMATION = "RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING";
private static final String SECURITY_PROVIDER = "BC";
private static final String DIGEST_ALGORITHM = "SHA-256";
private static final String MASKING_FUNCTION = "MGF1";
Run Code Online (Sandbox Code Playgroud)
错误发生的代码片段如下: -
private byte[] decryptSecretKeyData(byte[] encryptedSecretKey, byte[] iv, PrivateKey privateKey) throws Exception {
try {
Cipher rsaCipher = Cipher.getInstance(TRANSFORMATION, SECURITY_PROVIDER);
System.out.println("Cipher block initialized"); - **Printed**
PSource pSrc = (new PSource.PSpecified(iv));
System.out.println("PSource inisitialized"); …Run Code Online (Sandbox Code Playgroud)