Java 类org.bouncycastle.asn1.cms.KeyTransRecipientInfo 实例源码

项目:ipack    文件:CMSEnvelopedHelper.java   
private static void readRecipientInfo(
    List infos, RecipientInfo info, AlgorithmIdentifier messageAlgorithm, CMSSecureReadable secureReadable, AuthAttributesProvider additionalData)
{
    ASN1Encodable recipInfo = info.getInfo();
    if (recipInfo instanceof KeyTransRecipientInfo)
    {
        infos.add(new KeyTransRecipientInformation(
            (KeyTransRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KEKRecipientInfo)
    {
        infos.add(new KEKRecipientInformation(
            (KEKRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KeyAgreeRecipientInfo)
    {
        KeyAgreeRecipientInformation.readRecipientInfo(infos,
            (KeyAgreeRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData);
    }
    else if (recipInfo instanceof PasswordRecipientInfo)
    {
        infos.add(new PasswordRecipientInformation(
            (PasswordRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
}
项目:ipack    文件:KeyTransRecipientInformation.java   
KeyTransRecipientInformation(
    KeyTransRecipientInfo   info,
    AlgorithmIdentifier     messageAlgorithm,
    CMSSecureReadable       secureReadable,
    AuthAttributesProvider  additionalData)
{
    super(info.getKeyEncryptionAlgorithm(), messageAlgorithm, secureReadable, additionalData);

    this.info = info;

    RecipientIdentifier r = info.getRecipientIdentifier();

    if (r.isTagged())
    {
        ASN1OctetString octs = ASN1OctetString.getInstance(r.getId());

        rid = new KeyTransRecipientId(octs.getOctets());
    }
    else
    {
        IssuerAndSerialNumber   iAnds = IssuerAndSerialNumber.getInstance(r.getId());

        rid = new KeyTransRecipientId(iAnds.getName(), iAnds.getSerialNumber().getValue());
    }
}
项目:itext2    文件:PdfPublicKeySecurityHandler.java   
private KeyTransRecipientInfo computeRecipientInfo(X509Certificate x509certificate, byte[] abyte0)
    throws GeneralSecurityException, IOException
{
    ASN1InputStream asn1inputstream = 
        new ASN1InputStream(new ByteArrayInputStream(x509certificate.getTBSCertificate()));
    TBSCertificateStructure tbscertificatestructure = 
        TBSCertificateStructure.getInstance(asn1inputstream.readObject());
    AlgorithmIdentifier algorithmidentifier = tbscertificatestructure.getSubjectPublicKeyInfo().getAlgorithm();
    IssuerAndSerialNumber issuerandserialnumber = 
        new IssuerAndSerialNumber(
            tbscertificatestructure.getIssuer(), 
            tbscertificatestructure.getSerialNumber().getValue());
    Cipher cipher = Cipher.getInstance(algorithmidentifier.getAlgorithm().getId());        
    cipher.init(1, x509certificate);
    DEROctetString deroctetstring = new DEROctetString(cipher.doFinal(abyte0));
    RecipientIdentifier recipId = new RecipientIdentifier(issuerandserialnumber);
    return new KeyTransRecipientInfo( recipId, algorithmidentifier, deroctetstring);
}
项目:gwt-crypto    文件:CMSEnvelopedHelper.java   
private static void readRecipientInfo(
    List infos, RecipientInfo info, AlgorithmIdentifier messageAlgorithm, CMSSecureReadable secureReadable, AuthAttributesProvider additionalData)
{
    ASN1Encodable recipInfo = info.getInfo();
    if (recipInfo instanceof KeyTransRecipientInfo)
    {
        infos.add(new KeyTransRecipientInformation(
            (KeyTransRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KEKRecipientInfo)
    {
        infos.add(new KEKRecipientInformation(
            (KEKRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KeyAgreeRecipientInfo)
    {
        KeyAgreeRecipientInformation.readRecipientInfo(infos,
            (KeyAgreeRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData);
    }
    else if (recipInfo instanceof PasswordRecipientInfo)
    {
        infos.add(new PasswordRecipientInformation(
            (PasswordRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
}
项目:gwt-crypto    文件:KeyTransRecipientInformation.java   
KeyTransRecipientInformation(
    KeyTransRecipientInfo   info,
    AlgorithmIdentifier     messageAlgorithm,
    CMSSecureReadable       secureReadable,
    AuthAttributesProvider  additionalData)
{
    super(info.getKeyEncryptionAlgorithm(), messageAlgorithm, secureReadable, additionalData);

    this.info = info;

    RecipientIdentifier r = info.getRecipientIdentifier();

    if (r.isTagged())
    {
        ASN1OctetString octs = ASN1OctetString.getInstance(r.getId());

        rid = new KeyTransRecipientId(octs.getOctets());
    }
    else
    {
        IssuerAndSerialNumber   iAnds = IssuerAndSerialNumber.getInstance(r.getId());

        rid = new KeyTransRecipientId(iAnds.getName(), iAnds.getSerialNumber().getValue());
    }
}
项目:Aki-SSL    文件:CMSEnvelopedHelper.java   
private static void readRecipientInfo(
    List infos, RecipientInfo info, AlgorithmIdentifier messageAlgorithm, CMSSecureReadable secureReadable, AuthAttributesProvider additionalData)
{
    ASN1Encodable recipInfo = info.getInfo();
    if (recipInfo instanceof KeyTransRecipientInfo)
    {
        infos.add(new KeyTransRecipientInformation(
            (KeyTransRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KEKRecipientInfo)
    {
        infos.add(new KEKRecipientInformation(
            (KEKRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KeyAgreeRecipientInfo)
    {
        KeyAgreeRecipientInformation.readRecipientInfo(infos,
            (KeyAgreeRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData);
    }
    else if (recipInfo instanceof PasswordRecipientInfo)
    {
        infos.add(new PasswordRecipientInformation(
            (PasswordRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
}
项目:Aki-SSL    文件:KeyTransRecipientInformation.java   
KeyTransRecipientInformation(
    KeyTransRecipientInfo   info,
    AlgorithmIdentifier     messageAlgorithm,
    CMSSecureReadable       secureReadable,
    AuthAttributesProvider  additionalData)
{
    super(info.getKeyEncryptionAlgorithm(), messageAlgorithm, secureReadable, additionalData);

    this.info = info;

    RecipientIdentifier r = info.getRecipientIdentifier();

    if (r.isTagged())
    {
        ASN1OctetString octs = ASN1OctetString.getInstance(r.getId());

        rid = new KeyTransRecipientId(octs.getOctets());
    }
    else
    {
        IssuerAndSerialNumber   iAnds = IssuerAndSerialNumber.getInstance(r.getId());

        rid = new KeyTransRecipientId(iAnds.getName(), iAnds.getSerialNumber().getValue());
    }
}
项目:irma_future_id    文件:CMSEnvelopedHelper.java   
private static void readRecipientInfo(
    List infos, RecipientInfo info, AlgorithmIdentifier messageAlgorithm, CMSSecureReadable secureReadable, AuthAttributesProvider additionalData)
{
    ASN1Encodable recipInfo = info.getInfo();
    if (recipInfo instanceof KeyTransRecipientInfo)
    {
        infos.add(new KeyTransRecipientInformation(
            (KeyTransRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KEKRecipientInfo)
    {
        infos.add(new KEKRecipientInformation(
            (KEKRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KeyAgreeRecipientInfo)
    {
        KeyAgreeRecipientInformation.readRecipientInfo(infos,
            (KeyAgreeRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData);
    }
    else if (recipInfo instanceof PasswordRecipientInfo)
    {
        infos.add(new PasswordRecipientInformation(
            (PasswordRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
}
项目:irma_future_id    文件:KeyTransRecipientInformation.java   
KeyTransRecipientInformation(
    KeyTransRecipientInfo   info,
    AlgorithmIdentifier     messageAlgorithm,
    CMSSecureReadable       secureReadable,
    AuthAttributesProvider  additionalData)
{
    super(info.getKeyEncryptionAlgorithm(), messageAlgorithm, secureReadable, additionalData);

    this.info = info;

    RecipientIdentifier r = info.getRecipientIdentifier();

    if (r.isTagged())
    {
        ASN1OctetString octs = ASN1OctetString.getInstance(r.getId());

        rid = new KeyTransRecipientId(octs.getOctets());
    }
    else
    {
        IssuerAndSerialNumber   iAnds = IssuerAndSerialNumber.getInstance(r.getId());

        rid = new KeyTransRecipientId(iAnds.getName(), iAnds.getSerialNumber().getValue());
    }
}
项目:irma_future_id    文件:CMSEnvelopedHelper.java   
private static void readRecipientInfo(
    List infos, RecipientInfo info, AlgorithmIdentifier messageAlgorithm, CMSSecureReadable secureReadable, AuthAttributesProvider additionalData)
{
    ASN1Encodable recipInfo = info.getInfo();
    if (recipInfo instanceof KeyTransRecipientInfo)
    {
        infos.add(new KeyTransRecipientInformation(
            (KeyTransRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KEKRecipientInfo)
    {
        infos.add(new KEKRecipientInformation(
            (KEKRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KeyAgreeRecipientInfo)
    {
        KeyAgreeRecipientInformation.readRecipientInfo(infos,
            (KeyAgreeRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData);
    }
    else if (recipInfo instanceof PasswordRecipientInfo)
    {
        infos.add(new PasswordRecipientInformation(
            (PasswordRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
}
项目:irma_future_id    文件:KeyTransRecipientInformation.java   
KeyTransRecipientInformation(
    KeyTransRecipientInfo   info,
    AlgorithmIdentifier     messageAlgorithm,
    CMSSecureReadable       secureReadable,
    AuthAttributesProvider  additionalData)
{
    super(info.getKeyEncryptionAlgorithm(), messageAlgorithm, secureReadable, additionalData);

    this.info = info;

    RecipientIdentifier r = info.getRecipientIdentifier();

    if (r.isTagged())
    {
        ASN1OctetString octs = ASN1OctetString.getInstance(r.getId());

        rid = new KeyTransRecipientId(octs.getOctets());
    }
    else
    {
        IssuerAndSerialNumber   iAnds = IssuerAndSerialNumber.getInstance(r.getId());

        rid = new KeyTransRecipientId(iAnds.getName(), iAnds.getSerialNumber().getValue());
    }
}
项目:irma_future_id    文件:CMSEnvelopedHelper.java   
private static void readRecipientInfo(
    List infos, RecipientInfo info, AlgorithmIdentifier messageAlgorithm, CMSSecureReadable secureReadable, AuthAttributesProvider additionalData)
{
    ASN1Encodable recipInfo = info.getInfo();
    if (recipInfo instanceof KeyTransRecipientInfo)
    {
        infos.add(new KeyTransRecipientInformation(
            (KeyTransRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KEKRecipientInfo)
    {
        infos.add(new KEKRecipientInformation(
            (KEKRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KeyAgreeRecipientInfo)
    {
        KeyAgreeRecipientInformation.readRecipientInfo(infos,
            (KeyAgreeRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData);
    }
    else if (recipInfo instanceof PasswordRecipientInfo)
    {
        infos.add(new PasswordRecipientInformation(
            (PasswordRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
}
项目:irma_future_id    文件:CMSEnvelopedHelper.java   
private static void readRecipientInfo(
    List infos, RecipientInfo info, AlgorithmIdentifier messageAlgorithm, CMSSecureReadable secureReadable, AuthAttributesProvider additionalData)
{
    ASN1Encodable recipInfo = info.getInfo();
    if (recipInfo instanceof KeyTransRecipientInfo)
    {
        infos.add(new KeyTransRecipientInformation(
            (KeyTransRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KEKRecipientInfo)
    {
        infos.add(new KEKRecipientInformation(
            (KEKRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KeyAgreeRecipientInfo)
    {
        KeyAgreeRecipientInformation.readRecipientInfo(infos,
            (KeyAgreeRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData);
    }
    else if (recipInfo instanceof PasswordRecipientInfo)
    {
        infos.add(new PasswordRecipientInformation(
            (PasswordRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
}
项目:bc-java    文件:CMSEnvelopedHelper.java   
private static void readRecipientInfo(
    List infos, RecipientInfo info, AlgorithmIdentifier messageAlgorithm, CMSSecureReadable secureReadable, AuthAttributesProvider additionalData)
{
    ASN1Encodable recipInfo = info.getInfo();
    if (recipInfo instanceof KeyTransRecipientInfo)
    {
        infos.add(new KeyTransRecipientInformation(
            (KeyTransRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KEKRecipientInfo)
    {
        infos.add(new KEKRecipientInformation(
            (KEKRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KeyAgreeRecipientInfo)
    {
        KeyAgreeRecipientInformation.readRecipientInfo(infos,
            (KeyAgreeRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData);
    }
    else if (recipInfo instanceof PasswordRecipientInfo)
    {
        infos.add(new PasswordRecipientInformation(
            (PasswordRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
}
项目:bc-java    文件:KeyTransRecipientInformation.java   
KeyTransRecipientInformation(
    KeyTransRecipientInfo   info,
    AlgorithmIdentifier     messageAlgorithm,
    CMSSecureReadable       secureReadable,
    AuthAttributesProvider  additionalData)
{
    super(info.getKeyEncryptionAlgorithm(), messageAlgorithm, secureReadable, additionalData);

    this.info = info;

    RecipientIdentifier r = info.getRecipientIdentifier();

    if (r.isTagged())
    {
        ASN1OctetString octs = ASN1OctetString.getInstance(r.getId());

        rid = new KeyTransRecipientId(octs.getOctets());
    }
    else
    {
        IssuerAndSerialNumber   iAnds = IssuerAndSerialNumber.getInstance(r.getId());

        rid = new KeyTransRecipientId(iAnds.getName(), iAnds.getSerialNumber().getValue());
    }
}
项目:bc-java    文件:CMSEnvelopedHelper.java   
private static void readRecipientInfo(
    List infos, RecipientInfo info, AlgorithmIdentifier messageAlgorithm, CMSSecureReadable secureReadable, AuthAttributesProvider additionalData)
{
    ASN1Encodable recipInfo = info.getInfo();
    if (recipInfo instanceof KeyTransRecipientInfo)
    {
        infos.add(new KeyTransRecipientInformation(
            (KeyTransRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KEKRecipientInfo)
    {
        infos.add(new KEKRecipientInformation(
            (KEKRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KeyAgreeRecipientInfo)
    {
        KeyAgreeRecipientInformation.readRecipientInfo(infos,
            (KeyAgreeRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData);
    }
    else if (recipInfo instanceof PasswordRecipientInfo)
    {
        infos.add(new PasswordRecipientInformation(
            (PasswordRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
}
项目:bc-java    文件:KeyTransRecipientInformation.java   
KeyTransRecipientInformation(
    KeyTransRecipientInfo   info,
    AlgorithmIdentifier     messageAlgorithm,
    CMSSecureReadable       secureReadable,
    AuthAttributesProvider  additionalData)
{
    super(info.getKeyEncryptionAlgorithm(), messageAlgorithm, secureReadable, additionalData);

    this.info = info;

    RecipientIdentifier r = info.getRecipientIdentifier();

    if (r.isTagged())
    {
        ASN1OctetString octs = ASN1OctetString.getInstance(r.getId());

        rid = new KeyTransRecipientId(octs.getOctets());
    }
    else
    {
        IssuerAndSerialNumber   iAnds = IssuerAndSerialNumber.getInstance(r.getId());

        rid = new KeyTransRecipientId(iAnds.getName(), iAnds.getSerialNumber().getValue());
    }
}
项目:bc-java    文件:CMSEnvelopedHelper.java   
private static void readRecipientInfo(
    List infos, RecipientInfo info, AlgorithmIdentifier messageAlgorithm, CMSSecureReadable secureReadable, AuthAttributesProvider additionalData)
{
    ASN1Encodable recipInfo = info.getInfo();
    if (recipInfo instanceof KeyTransRecipientInfo)
    {
        infos.add(new KeyTransRecipientInformation(
            (KeyTransRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KEKRecipientInfo)
    {
        infos.add(new KEKRecipientInformation(
            (KEKRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KeyAgreeRecipientInfo)
    {
        KeyAgreeRecipientInformation.readRecipientInfo(infos,
            (KeyAgreeRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData);
    }
    else if (recipInfo instanceof PasswordRecipientInfo)
    {
        infos.add(new PasswordRecipientInformation(
            (PasswordRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
}
项目:bc-java    文件:CMSEnvelopedHelper.java   
private static void readRecipientInfo(
    List infos, RecipientInfo info, AlgorithmIdentifier messageAlgorithm, CMSSecureReadable secureReadable, AuthAttributesProvider additionalData)
{
    ASN1Encodable recipInfo = info.getInfo();
    if (recipInfo instanceof KeyTransRecipientInfo)
    {
        infos.add(new KeyTransRecipientInformation(
            (KeyTransRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KEKRecipientInfo)
    {
        infos.add(new KEKRecipientInformation(
            (KEKRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
    else if (recipInfo instanceof KeyAgreeRecipientInfo)
    {
        KeyAgreeRecipientInformation.readRecipientInfo(infos,
            (KeyAgreeRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData);
    }
    else if (recipInfo instanceof PasswordRecipientInfo)
    {
        infos.add(new PasswordRecipientInformation(
            (PasswordRecipientInfo)recipInfo, messageAlgorithm, secureReadable, additionalData));
    }
}
项目:itext2    文件:PdfPublicKeySecurityHandler.java   
private ASN1Primitive createDERForRecipient(byte[] in, X509Certificate cert) 
    throws IOException,  
           GeneralSecurityException 
{

    String s = "1.2.840.113549.3.2";

    AlgorithmParameterGenerator algorithmparametergenerator = AlgorithmParameterGenerator.getInstance(s);
    AlgorithmParameters algorithmparameters = algorithmparametergenerator.generateParameters();
    ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(algorithmparameters.getEncoded("ASN.1"));
    ASN1InputStream asn1inputstream = new ASN1InputStream(bytearrayinputstream);
    ASN1Primitive derobject = asn1inputstream.readObject();
    KeyGenerator keygenerator = KeyGenerator.getInstance(s);
    keygenerator.init(128);
    SecretKey secretkey = keygenerator.generateKey();
    Cipher cipher = Cipher.getInstance(s);
    cipher.init(1, secretkey, algorithmparameters);
    byte[] abyte1 = cipher.doFinal(in);
    DEROctetString deroctetstring = new DEROctetString(abyte1);
    KeyTransRecipientInfo keytransrecipientinfo = computeRecipientInfo(cert, secretkey.getEncoded());
    DERSet derset = new DERSet(new RecipientInfo(keytransrecipientinfo));
    AlgorithmIdentifier algorithmidentifier = new AlgorithmIdentifier(new ASN1ObjectIdentifier(s), derobject);
    EncryptedContentInfo encryptedcontentinfo = 
        new EncryptedContentInfo(PKCSObjectIdentifiers.data, algorithmidentifier, deroctetstring);
    EnvelopedData env = new EnvelopedData(null, derset, encryptedcontentinfo, (org.bouncycastle.asn1.ASN1Set) null);
    ContentInfo contentinfo = 
        new ContentInfo(PKCSObjectIdentifiers.envelopedData, env);
    return contentinfo.toASN1Primitive();        
}