Use private key algorithm

pull/185/head
M66B 4 years ago
parent 37953b2168
commit 5b00bbd321

@ -2716,7 +2716,12 @@ public class FragmentCompose extends FragmentBase {
CMSSignedDataGenerator cmsGenerator = new CMSSignedDataGenerator(); CMSSignedDataGenerator cmsGenerator = new CMSSignedDataGenerator();
cmsGenerator.addCertificates(store); cmsGenerator.addCertificates(store);
ContentSigner contentSigner = new JcaContentSignerBuilder("SHA256withRSA") String algorithm = privkey.getAlgorithm();
Log.i("Private key algorithm=" + algorithm);
if (TextUtils.isEmpty(algorithm))
algorithm = "RSA";
ContentSigner contentSigner = new JcaContentSignerBuilder("SHA256with" + algorithm)
.build(privkey); .build(privkey);
DigestCalculatorProvider digestCalculator = new JcaDigestCalculatorProviderBuilder() DigestCalculatorProvider digestCalculator = new JcaDigestCalculatorProviderBuilder()
.build(); .build();

Loading…
Cancel
Save