List of usage examples for org.bouncycastle.cms.jcajce JcaSimpleSignerInfoGeneratorBuilder setDirectSignature
public JcaSimpleSignerInfoGeneratorBuilder setDirectSignature(boolean hasNoSignedAttributes)
From source file:com.mycompany.mavenproject1.Signer.java
public void init(P12KeyContainer keyContainer) throws CertificateEncodingException, OperatorCreationException, CMSException { Security.addProvider(new BouncyCastleProvider()); List certList = new ArrayList(); X509Certificate cert = (X509Certificate) keyContainer.certificate; certList.add(cert);/*ww w . j a va 2 s . com*/ Store certsStore = new JcaCertStore(certList); generator = new CMSSignedDataGenerator(); JcaSimpleSignerInfoGeneratorBuilder genInfo = new JcaSimpleSignerInfoGeneratorBuilder(); genInfo.setProvider("BC"); genInfo.setDirectSignature(true); SignerInfoGenerator signerInfoGenerator = genInfo.build("GOST3411withECGOST3410", (PrivateKey) keyContainer.privateKey, cert); generator.addSignerInfoGenerator(signerInfoGenerator); generator.addCertificates(certsStore); }