1

I don't quite understand, what exactly is Lightweight API and how to use it.

  1. Is there a compiled jar anywhere? I can download source code only.
  2. They say "From 1.47, the version 2 APIs are in the pcpkix packages"

e.g. a piece of code

        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 are in bcprovider (or lcrypto) jar. BcDigestCalculatorProvider, BcRSAContentSignerBuilder are in pcpix jar.

AlgorithmIdentifier, Store etc are not a part of lightweight API?

3.In order to use Lightweight API do I have to use several jars or is there all-in-1 jar ?

4

0 回答 0