org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoGeneratorBuilder.build()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoGeneratorBuilder.build()方法的一些代码示例,展示了JcaSimpleSignerInfoGeneratorBuilder.build()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JcaSimpleSignerInfoGeneratorBuilder.build()方法的具体详情如下:
包路径:org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoGeneratorBuilder
类名称:JcaSimpleSignerInfoGeneratorBuilder
方法名:build

JcaSimpleSignerInfoGeneratorBuilder.build介绍

暂无

代码示例

代码示例来源:origin: resteasy/Resteasy

@Override
  public void writeTo(SignedOutput out, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> headers, OutputStream os) throws IOException, WebApplicationException
  {
   try
   {
     SMIMESignedGenerator gen = new SMIMESignedGenerator();
     SignerInfoGenerator signer = new JcaSimpleSignerInfoGeneratorBuilder().setProvider("BC").build("SHA1WITHRSA", out.getPrivateKey(), out.getCertificate());
     gen.addSignerInfoGenerator(signer);

     MimeMultipart mp = gen.generate(EnvelopedWriter.createBodyPart(providers, out));
     String contentType = mp.getContentType();
     contentType = contentType.replace("\r\n", "").replace("\t", " ");
     headers.putSingle("Content-Type", contentType);
     mp.writeTo(os);
   }
   catch (Exception e)
   {
     throw new WriterException(e);
   }
  }
}

代码示例来源:origin: stackoverflow.com

final ASN1EncodableVector signedAttributes = new ASN1EncodableVector();
final Attribute signingAttribute = new Attribute(CMSAttributes.signingTime, new DERSet(new DERUTCTime(new Date()))); 
signedAttributes.add(signingAttribute);
// Create the signing table
final AttributeTable signedAttributesTable = new AttributeTable(signedAttributes);
// Create the table table generator that will added to the Signer builder
final DefaultSignedAttributeTableGenerator signedAttributeGenerator = new DefaultSignedAttributeTableGenerator(signedAttributesTable);

final JcaSimpleSignerInfoGeneratorBuilder builder = new JcaSimpleSignerInfoGeneratorBuilder().setProvider(BouncyCastleProvider.PROVIDER_NAME);
builder.setSignedAttributeGenerator(signedAttributeGenerator); 
// ****** DO NOT call: setDirectSignature(true); *****
final SignerInfoGenerator signerGenerator = builder.build("SHA1withRSA", key, cert);

代码示例来源:origin: stackoverflow.com

signer.addSignerInfoGenerator(builder.build("SHA1withRSA", privateKey, signerCert));
signer.addCertificates(certs);

代码示例来源:origin: org.demoiselle.signer/signature-timestamp

SignerInfoGenerator signerInfoGenerator = new JcaSimpleSignerInfoGeneratorBuilder().build("SHA256withRSA", privateKey, signCert);
generator.addSignerInfoGenerator(signerInfoGenerator);

代码示例来源:origin: org.demoiselle.signer/timestamp

SignerInfoGenerator signerInfoGenerator = new JcaSimpleSignerInfoGeneratorBuilder().build(varAlgorithm, privateKey, signCert);
generator.addSignerInfoGenerator(signerInfoGenerator);

代码示例来源:origin: OpenAS2/OpenAs2App

sig = jSig.build(digest + "with" + encryptAlg, privKey, x509Cert);

代码示例来源:origin: org.apache.james/apache-mailet-crypto

/**
 * Creates an <CODE>SMIMESignedGenerator</CODE>. Includes a signer private key and certificate,
 * and a pool of certs and cerls (if any) to go with the signature.
 * @return The generated SMIMESignedGenerator.
 */
public SMIMESignedGenerator createGenerator() throws CertStoreException, SMIMEException, OperatorCreationException,
  CertificateEncodingException {
  
  // create the generator for creating an smime/signed message
  SMIMESignedGenerator generator = new SMIMESignedGenerator();
  
  // add a signer to the generator - this specifies we are using SHA1
  // the encryption algorithm used is taken from the key
  SignerInfoGenerator signerInfoGenerator = new JcaSimpleSignerInfoGeneratorBuilder()
    .setProvider("BC")
    .build("SHA1withRSA", privateKey, certificate);
  generator.addSignerInfoGenerator(signerInfoGenerator);
  
  // add our pool of certs and cerls (if any) to go with the signature
  generator.addCertificates(jcaCertStore);
  
  return generator;
  
}

代码示例来源:origin: com.axway.ats.framework/ats-actionlibrary

signerGeneratorBuilder.setProvider(BouncyCastleProvider.PROVIDER_NAME);
signerGeneratorBuilder.setSignedAttributeGenerator(new AttributeTable(attributes));
signer.addSignerInfoGenerator(signerGeneratorBuilder.build(signatureAlgorithm, privateKey,
                              cer));

代码示例来源:origin: phax/as2-lib

.build (eAlgorithm.getSignAlgorithmName (),
    aPrivateKey,
    aX509Cert));

代码示例来源:origin: pavansolapure/opencodez-samples

.setProvider("BC")
.setSignedAttributeGenerator(new AttributeTable(attributes))
.build("SHA1withRSA", certDetails.getPrivateKey(), 
    certDetails.getX509Certificate()));

代码示例来源:origin: no.difi.oxalis/oxalis-as2

.setSignedAttributeGenerator(new AttributeTable(signedAttrs))
      .build(digestMethod.getMethod(), privateKey, ourCertificate));
} catch (OperatorCreationException e) {
  throw new OxalisTransmissionException("Unable to add Signer information. " + e.getMessage(), e);

代码示例来源:origin: difi/oxalis

.setSignedAttributeGenerator(new AttributeTable(signedAttrs))
      .build(digestMethod.getMethod(), privateKey, ourCertificate));
} catch (OperatorCreationException e) {
  throw new OxalisTransmissionException("Unable to add Signer information. " + e.getMessage(), e);

代码示例来源:origin: org.demoiselle.signer/signature-signer

gen.addCertificates(this.generatedCertStore());
SignerInfoGenerator signerInfoGenerator = new JcaSimpleSignerInfoGeneratorBuilder().setSignedAttributeGenerator(signedAttributeGenerator).setUnsignedAttributeGenerator(unsignedAttributeGenerator).build(AlgorithmNames.getAlgorithmNameByOID(algAndLength.getAlgID().getValue()), this.pkcs1.getPrivateKey(), this.certificate);
gen.addSignerInfoGenerator(signerInfoGenerator);

相关文章