我不太明白,Lightweight API究竟是什么以及如何使用它。
e.g。一段代码
Store certs = new JcaCertStore(certList);
AlgorithmIdentifier sigAlgId = new DefaultSignatureAlgorithmIdentifierFinder().find(algorithmName);
AlgorithmIdentifier digAlgId = new DefaultDigestAlgorithmIdentifierFinder().find(sigAlgId);
ContentSigner sigGen = new BcRSAContentSignerBuilder(sigAlgId, digAlgId).build(toRSAPrivateKey(pKey));
CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
X509CertificateHolder certHolder = new X509CertificateHolder(cert.getEncoded());
gen.addSignerInfoGenerator(new SignerInfoGeneratorBuilder(new BcDigestCalculatorProvider()).setDirectSignature(true).build(sigGen, certHolder));
gen.addCertificates(certs);
.....
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
DEROutputStream dOut = new DEROutputStream(bOut);
dOut.writeObject(s.toASN1Structure().toASN1Primitive());
dOut.close();
Store,AlgorithmIdentifier,DEROutputStream位于bcprovider(或lcrypto)jar中。 BcDigestCalculatorProvider,BcRSAContentSignerBuilder在pcpix jar中。
AlgorithmIdentifier,Store等不是轻量级API的一部分吗?
3.为了使用Lightweight API,我必须使用几个罐子,还是有多功能罐子?