本文整理汇总了Java中org.bouncycastle.cms.KeyTransRecipientId类的典型用法代码示例。如果您正苦于以下问题:Java KeyTransRecipientId类的具体用法?Java KeyTransRecipientId怎么用?Java KeyTransRecipientId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KeyTransRecipientId类属于org.bouncycastle.cms包,在下文中一共展示了KeyTransRecipientId类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getKeyTransRecipientId
import org.bouncycastle.cms.KeyTransRecipientId; //导入依赖的package包/类
public KeyTransRecipientId getKeyTransRecipientId(X509CertSelector certSelector)
{
try
{
if (certSelector.getSubjectKeyIdentifier() != null)
{
return new KeyTransRecipientId(X500Name.getInstance(certSelector.getIssuerAsBytes()), certSelector.getSerialNumber(), ASN1OctetString.getInstance(certSelector.getSubjectKeyIdentifier()).getOctets());
}
else
{
return new KeyTransRecipientId(X500Name.getInstance(certSelector.getIssuerAsBytes()), certSelector.getSerialNumber());
}
}
catch (IOException e)
{
throw new IllegalArgumentException("unable to convert issuer: " + e.getMessage());
}
}
开发者ID:Appdome,项目名称:ipack,代码行数:19,代码来源:JcaSelectorConverter.java
示例2: appendCertInfo
import org.bouncycastle.cms.KeyTransRecipientId; //导入依赖的package包/类
private void appendCertInfo(StringBuilder extraInfo, KeyTransRecipientId ktRid,
X509Certificate certificate, X509CertificateHolder materialCert)
{
BigInteger ridSerialNumber = ktRid.getSerialNumber();
if (ridSerialNumber != null)
{
String certSerial = "unknown";
BigInteger certSerialNumber = certificate.getSerialNumber();
if (certSerialNumber != null)
{
certSerial = certSerialNumber.toString(16);
}
extraInfo.append("serial-#: rid ");
extraInfo.append(ridSerialNumber.toString(16));
extraInfo.append(" vs. cert ");
extraInfo.append(certSerial);
extraInfo.append(" issuer: rid \'");
extraInfo.append(ktRid.getIssuer());
extraInfo.append("\' vs. cert \'");
extraInfo.append(materialCert == null ? "null" : materialCert.getIssuer());
extraInfo.append("\' ");
}
}
开发者ID:torakiki,项目名称:sambox,代码行数:24,代码来源:PublicKeySecurityHandler.java
示例3: getKeyTransRecipientId
import org.bouncycastle.cms.KeyTransRecipientId; //导入依赖的package包/类
public KeyTransRecipientId getKeyTransRecipientId(X509CertSelector certSelector)
{
try
{
if (certSelector.getSubjectKeyIdentifier() != null)
{
return new KeyTransRecipientId(X500Name.getInstance(certSelector.getIssuerAsBytes()), certSelector.getSerialNumber(), ASN1OctetString.getInstance(certSelector.getSubjectKeyIdentifier()).getOctets());
}
else
{
return new KeyTransRecipientId(X500Name.getInstance(certSelector.getIssuerAsBytes()), certSelector.getSerialNumber());
}
}
catch (Exception e)
{
throw new IllegalArgumentException("conversion failed: " + e.toString());
}
}
开发者ID:credentials,项目名称:irma_future_id,代码行数:19,代码来源:JcaSelectorConverter.java
示例4: getPartyVInfoFromRID
import org.bouncycastle.cms.KeyTransRecipientId; //导入依赖的package包/类
protected static byte[] getPartyVInfoFromRID(KeyTransRecipientId recipientId)
throws IOException
{
if (recipientId.getSerialNumber() != null)
{
return new IssuerAndSerialNumber(recipientId.getIssuer(), recipientId.getSerialNumber()).getEncoded(ASN1Encoding.DER);
}
else
{
return new DEROctetString(recipientId.getSubjectKeyIdentifier()).getEncoded();
}
}
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:13,代码来源:JceKTSKeyTransRecipient.java
示例5: testCapEncrypt
import org.bouncycastle.cms.KeyTransRecipientId; //导入依赖的package包/类
public void testCapEncrypt()
throws Exception
{
MimeBodyPart _msg = SMIMETestUtil.makeMimeBodyPart("WallaWallaWashington");
SMIMEEnvelopedGenerator gen = new SMIMEEnvelopedGenerator();
//
// create a subject key id - this has to be done the same way as
// it is done in the certificate associated with the private key
//
MessageDigest dig = MessageDigest.getInstance("SHA1", "BC");
dig.update(_reciCert.getPublicKey().getEncoded());
gen.addKeyTransRecipient(_reciCert.getPublicKey(), dig.digest());
//
// generate a MimeBodyPart object which encapsulates the content
// we want encrypted.
//
MimeBodyPart mp = gen.generate(_msg, SMIMEEnvelopedGenerator.RC2_CBC, 40, "BC");
SMIMEEnveloped m = new SMIMEEnveloped(mp);
dig.update(_reciCert.getPublicKey().getEncoded());
RecipientId recId = new KeyTransRecipientId(dig.digest());
RecipientInformationStore recipients = m.getRecipientInfos();
RecipientInformation recipient = recipients.get(recId);
MimeBodyPart res = SMIMEUtil.toMimeBodyPart(recipient.getContent(_reciKP.getPrivate(), "BC"));
verifyMessageBytes(_msg, res);
}
开发者ID:credentials,项目名称:irma_future_id,代码行数:37,代码来源:SMIMEEnvelopedTest.java
示例6: testCapEncrypt
import org.bouncycastle.cms.KeyTransRecipientId; //导入依赖的package包/类
public void testCapEncrypt()
throws Exception
{
MimeBodyPart msg = SMIMETestUtil.makeMimeBodyPart("WallaWallaWashington");
SMIMEEnvelopedGenerator gen = new SMIMEEnvelopedGenerator();
//
// create a subject key id - this has to be done the same way as
// it is done in the certificate associated with the private key
//
MessageDigest dig = MessageDigest.getInstance("SHA1", BC);
dig.update(_reciCert.getPublicKey().getEncoded());
gen.addRecipientInfoGenerator(new JceKeyTransRecipientInfoGenerator(dig.digest(), _reciCert.getPublicKey()).setProvider(BC));
//
// generate a MimeBodyPart object which encapsulates the content
// we want encrypted.
//
MimeBodyPart mp = gen.generate(msg, new JceCMSContentEncryptorBuilder(CMSAlgorithm.RC2_CBC, 40).setProvider(BC).build());
SMIMEEnveloped m = new SMIMEEnveloped(mp);
dig.update(_reciCert.getPublicKey().getEncoded());
RecipientId recId = new KeyTransRecipientId(dig.digest());
RecipientInformationStore recipients = m.getRecipientInfos();
RecipientInformation recipient = recipients.get(recId);
MimeBodyPart res = SMIMEUtil.toMimeBodyPart(recipient.getContent(new JceKeyTransEnvelopedRecipient(_reciKP.getPrivate()).setProvider(BC)));
verifyMessageBytes(msg, res);
}
开发者ID:credentials,项目名称:irma_future_id,代码行数:37,代码来源:NewSMIMEEnvelopedTest.java
示例7: getCertSelector
import org.bouncycastle.cms.KeyTransRecipientId; //导入依赖的package包/类
public X509CertSelector getCertSelector(KeyTransRecipientId recipientId)
{
return doConversion(recipientId.getIssuer(), recipientId.getSerialNumber(), recipientId.getSubjectKeyIdentifier());
}
开发者ID:Appdome,项目名称:ipack,代码行数:5,代码来源:JcaX509CertSelectorConverter.java
示例8: getRecipientId
import org.bouncycastle.cms.KeyTransRecipientId; //导入依赖的package包/类
/**
* Return a RecipientId for the identity's (private key, certificate) pair.
*/
public RecipientId getRecipientId()
{
// TODO: handle key agreement
return new KeyTransRecipientId(certificateHolders[0].getIssuer(), certificateHolders[0].getSerialNumber(), getSubjectKeyIdentifier());
}
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:9,代码来源:PKIXIdentity.java
示例9: JceKTSKeyTransEnvelopedRecipient
import org.bouncycastle.cms.KeyTransRecipientId; //导入依赖的package包/类
public JceKTSKeyTransEnvelopedRecipient(PrivateKey recipientKey, KeyTransRecipientId recipientId)
throws IOException
{
super(recipientKey, getPartyVInfoFromRID(recipientId));
}
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:6,代码来源:JceKTSKeyTransEnvelopedRecipient.java
示例10: JceKTSKeyTransAuthenticatedRecipient
import org.bouncycastle.cms.KeyTransRecipientId; //导入依赖的package包/类
public JceKTSKeyTransAuthenticatedRecipient(PrivateKey recipientKey, KeyTransRecipientId recipientId)
throws IOException
{
super(recipientKey, getPartyVInfoFromRID(recipientId));
}
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:6,代码来源:JceKTSKeyTransAuthenticatedRecipient.java
示例11: testSubKeyId
import org.bouncycastle.cms.KeyTransRecipientId; //导入依赖的package包/类
public void testSubKeyId()
throws Exception
{
MimeBodyPart _msg = SMIMETestUtil.makeMimeBodyPart("WallaWallaWashington");
SMIMEEnvelopedGenerator gen = new SMIMEEnvelopedGenerator();
//
// create a subject key id - this has to be done the same way as
// it is done in the certificate associated with the private key
//
MessageDigest dig = MessageDigest.getInstance("SHA1", "BC");
dig.update(_reciCert.getPublicKey().getEncoded());
gen.addKeyTransRecipient(_reciCert.getPublicKey(), dig.digest());
//
// generate a MimeBodyPart object which encapsulates the content
// we want encrypted.
//
MimeBodyPart mp = gen.generate(_msg, SMIMEEnvelopedGenerator.DES_EDE3_CBC, "BC");
SMIMEEnveloped m = new SMIMEEnveloped(mp);
dig.update(_reciCert.getPublicKey().getEncoded());
RecipientId recId = new KeyTransRecipientId(dig.digest());
RecipientInformationStore recipients = m.getRecipientInfos();
RecipientInformation recipient = recipients.get(recId);
MimeBodyPart res = SMIMEUtil.toMimeBodyPart(recipient.getContent(_reciKP.getPrivate(), "BC"));
verifyMessageBytes(_msg, res);
}
开发者ID:credentials,项目名称:irma_future_id,代码行数:38,代码来源:SMIMEEnvelopedTest.java
示例12: testSubKeyId
import org.bouncycastle.cms.KeyTransRecipientId; //导入依赖的package包/类
public void testSubKeyId()
throws Exception
{
MimeBodyPart msg = SMIMETestUtil.makeMimeBodyPart("WallaWallaWashington");
SMIMEEnvelopedGenerator gen = new SMIMEEnvelopedGenerator();
//
// create a subject key id - this has to be done the same way as
// it is done in the certificate associated with the private key
//
MessageDigest dig = MessageDigest.getInstance("SHA1", BC);
dig.update(SubjectPublicKeyInfo.getInstance(_reciCert.getPublicKey().getEncoded()).getPublicKeyData().getBytes());
gen.addRecipientInfoGenerator(new JceKeyTransRecipientInfoGenerator(dig.digest(), _reciCert.getPublicKey()).setProvider(BC));
//
// generate a MimeBodyPart object which encapsulates the content
// we want encrypted.
//
MimeBodyPart mp = gen.generate(msg, new JceCMSContentEncryptorBuilder(CMSAlgorithm.DES_EDE3_CBC).setProvider(BC).build());
SMIMEEnveloped m = new SMIMEEnveloped(mp);
dig.update(SubjectPublicKeyInfo.getInstance(_reciCert.getPublicKey().getEncoded()).getPublicKeyData().getBytes());
RecipientId recId = new KeyTransRecipientId(dig.digest());
RecipientInformationStore recipients = m.getRecipientInfos();
RecipientInformation recipient = recipients.get(recId);
MimeBodyPart res = SMIMEUtil.toMimeBodyPart(recipient.getContent(new JceKeyTransEnvelopedRecipient(_reciKP.getPrivate()).setProvider(BC)));
verifyMessageBytes(msg, res);
}
开发者ID:credentials,项目名称:irma_future_id,代码行数:38,代码来源:NewSMIMEEnvelopedTest.java
注:本文中的org.bouncycastle.cms.KeyTransRecipientId类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论