forked from fornwall/apksigner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
notes.txt
24 lines (17 loc) · 825 Bytes
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...(keySet KeySet, content []byte)
List<X509Certificate> certList = new ArrayList<>()
.add(keySet.publicKey);
ContentSigner sha1Signer = new JcaContentSignerBuilder(keySet.signatureAlgorithm)
.setProvider("SC")
.build(keySet.privateKey);
DigestCalculatorProvider digestCalculatorProvider = new JcaDigestCalculatorProviderBuilder()
.setProvider("SC")
.build();
SignerInfoGenerator signerInfoGenerator = new JcaSignerInfoGeneratorBuilder(digestCalculatorProvider)
.setDirectSignature(true)
.build(sha1Signer, keySet.publicKey);
let gen = new CMSSignedDataGenerator()
.addSignerInfoGenerator(signerInfoGenerator)
.addCertificates(new JcaCertStore(certList));
CMSTypedData msg = new CMSProcessableByteArray(content);
return gen.generate(msg, false).toASN1Structure().getEncoded("DER");