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

项目:ipack    文件:KeyAgreeRecipientInformation.java   
private SubjectPublicKeyInfo getSenderPublicKeyInfo(AlgorithmIdentifier recKeyAlgId,
    OriginatorIdentifierOrKey originator)
    throws CMSException, IOException
{
    OriginatorPublicKey opk = originator.getOriginatorKey();
    if (opk != null)
    {
        return getPublicKeyInfoFromOriginatorPublicKey(recKeyAlgId, opk);
    }

    OriginatorId origID;

    IssuerAndSerialNumber iAndSN = originator.getIssuerAndSerialNumber();
    if (iAndSN != null)
    {
        origID = new OriginatorId(iAndSN.getName(), iAndSN.getSerialNumber().getValue());
    }
    else
    {
        SubjectKeyIdentifier ski = originator.getSubjectKeyIdentifier();

        origID = new OriginatorId(ski.getKeyIdentifier());
    }

    return getPublicKeyInfoFromOriginatorId(origID);
}
项目:gwt-crypto    文件:KeyAgreeRecipientInformation.java   
private SubjectPublicKeyInfo getSenderPublicKeyInfo(AlgorithmIdentifier recKeyAlgId,
    OriginatorIdentifierOrKey originator)
    throws CMSException, IOException
{
    OriginatorPublicKey opk = originator.getOriginatorKey();
    if (opk != null)
    {
        return getPublicKeyInfoFromOriginatorPublicKey(recKeyAlgId, opk);
    }

    OriginatorId origID;

    IssuerAndSerialNumber iAndSN = originator.getIssuerAndSerialNumber();
    if (iAndSN != null)
    {
        origID = new OriginatorId(iAndSN.getName(), iAndSN.getSerialNumber().getValue());
    }
    else
    {
        SubjectKeyIdentifier ski = originator.getSubjectKeyIdentifier();

        origID = new OriginatorId(ski.getKeyIdentifier());
    }

    return getPublicKeyInfoFromOriginatorId(origID);
}
项目:Aki-SSL    文件:KeyAgreeRecipientInformation.java   
private SubjectPublicKeyInfo getSenderPublicKeyInfo(AlgorithmIdentifier recKeyAlgId,
    OriginatorIdentifierOrKey originator)
    throws CMSException, IOException
{
    OriginatorPublicKey opk = originator.getOriginatorKey();
    if (opk != null)
    {
        return getPublicKeyInfoFromOriginatorPublicKey(recKeyAlgId, opk);
    }

    OriginatorId origID;

    IssuerAndSerialNumber iAndSN = originator.getIssuerAndSerialNumber();
    if (iAndSN != null)
    {
        origID = new OriginatorId(iAndSN.getName(), iAndSN.getSerialNumber().getValue());
    }
    else
    {
        SubjectKeyIdentifier ski = originator.getSubjectKeyIdentifier();

        origID = new OriginatorId(ski.getKeyIdentifier());
    }

    return getPublicKeyInfoFromOriginatorId(origID);
}
项目:irma_future_id    文件:KeyAgreeRecipientInformation.java   
private SubjectPublicKeyInfo getSenderPublicKeyInfo(AlgorithmIdentifier recKeyAlgId,
    OriginatorIdentifierOrKey originator)
    throws CMSException, IOException
{
    OriginatorPublicKey opk = originator.getOriginatorKey();
    if (opk != null)
    {
        return getPublicKeyInfoFromOriginatorPublicKey(recKeyAlgId, opk);
    }

    OriginatorId origID;

    IssuerAndSerialNumber iAndSN = originator.getIssuerAndSerialNumber();
    if (iAndSN != null)
    {
        origID = new OriginatorId(iAndSN.getName(), iAndSN.getSerialNumber().getValue());
    }
    else
    {
        SubjectKeyIdentifier ski = originator.getSubjectKeyIdentifier();

        origID = new OriginatorId(ski.getKeyIdentifier());
    }

    return getPublicKeyInfoFromOriginatorId(origID);
}
项目:irma_future_id    文件:KeyAgreeRecipientInformation.java   
private SubjectPublicKeyInfo getSenderPublicKeyInfo(AlgorithmIdentifier recKeyAlgId,
    OriginatorIdentifierOrKey originator)
    throws CMSException, IOException
{
    OriginatorPublicKey opk = originator.getOriginatorKey();
    if (opk != null)
    {
        return getPublicKeyInfoFromOriginatorPublicKey(recKeyAlgId, opk);
    }

    OriginatorId origID;

    IssuerAndSerialNumber iAndSN = originator.getIssuerAndSerialNumber();
    if (iAndSN != null)
    {
        origID = new OriginatorId(iAndSN.getName(), iAndSN.getSerialNumber().getValue());
    }
    else
    {
        SubjectKeyIdentifier ski = originator.getSubjectKeyIdentifier();

        origID = new OriginatorId(ski.getKeyIdentifier());
    }

    return getPublicKeyInfoFromOriginatorId(origID);
}
项目:bc-java    文件:KeyAgreeRecipientInformation.java   
private SubjectPublicKeyInfo getSenderPublicKeyInfo(AlgorithmIdentifier recKeyAlgId,
    OriginatorIdentifierOrKey originator)
    throws CMSException, IOException
{
    OriginatorPublicKey opk = originator.getOriginatorKey();
    if (opk != null)
    {
        return getPublicKeyInfoFromOriginatorPublicKey(recKeyAlgId, opk);
    }

    OriginatorId origID;

    IssuerAndSerialNumber iAndSN = originator.getIssuerAndSerialNumber();
    if (iAndSN != null)
    {
        origID = new OriginatorId(iAndSN.getName(), iAndSN.getSerialNumber().getValue());
    }
    else
    {
        SubjectKeyIdentifier ski = originator.getSubjectKeyIdentifier();

        origID = new OriginatorId(ski.getKeyIdentifier());
    }

    return getPublicKeyInfoFromOriginatorId(origID);
}
项目:bc-java    文件:KeyAgreeRecipientInformation.java   
private SubjectPublicKeyInfo getSenderPublicKeyInfo(AlgorithmIdentifier recKeyAlgId,
    OriginatorIdentifierOrKey originator)
    throws CMSException, IOException
{
    OriginatorPublicKey opk = originator.getOriginatorKey();
    if (opk != null)
    {
        return getPublicKeyInfoFromOriginatorPublicKey(recKeyAlgId, opk);
    }

    OriginatorId origID;

    IssuerAndSerialNumber iAndSN = originator.getIssuerAndSerialNumber();
    if (iAndSN != null)
    {
        origID = new OriginatorId(iAndSN.getName(), iAndSN.getSerialNumber().getValue());
    }
    else
    {
        SubjectKeyIdentifier ski = originator.getSubjectKeyIdentifier();

        origID = new OriginatorId(ski.getKeyIdentifier());
    }

    return getPublicKeyInfoFromOriginatorId(origID);
}
项目:ipack    文件:KeyAgreeRecipientInfoGenerator.java   
public RecipientInfo generate(GenericKey contentEncryptionKey)
    throws CMSException
{
    OriginatorIdentifierOrKey originator = new OriginatorIdentifierOrKey(
            createOriginatorPublicKey(originatorKeyInfo));

    ASN1EncodableVector params = new ASN1EncodableVector();
    params.add(keyEncryptionOID);
    params.add(DERNull.INSTANCE);
    AlgorithmIdentifier keyEncAlg = new AlgorithmIdentifier(keyEncryptionOID, DERNull.INSTANCE);
    AlgorithmIdentifier keyAgreeAlg = new AlgorithmIdentifier(keyAgreementOID, keyEncAlg);

    ASN1Sequence recipients = generateRecipientEncryptedKeys(keyAgreeAlg, keyEncAlg, contentEncryptionKey);
    ASN1Encodable userKeyingMaterial = getUserKeyingMaterial(keyAgreeAlg);

    if (userKeyingMaterial != null)
    {
        try
        {
            return new RecipientInfo(new KeyAgreeRecipientInfo(originator, new DEROctetString(userKeyingMaterial),
                keyAgreeAlg, recipients));
        }
        catch (IOException e)
        {
            throw new CMSException("unable to encode userKeyingMaterial: " + e.getMessage(), e);
        }
    }
    else
    {
        return new RecipientInfo(new KeyAgreeRecipientInfo(originator, null,
            keyAgreeAlg, recipients));
    }
}
项目:gwt-crypto    文件:KeyAgreeRecipientInfoGenerator.java   
public RecipientInfo generate(GenericKey contentEncryptionKey)
    throws CMSException
{
    OriginatorIdentifierOrKey originator = new OriginatorIdentifierOrKey(
            createOriginatorPublicKey(originatorKeyInfo));

    AlgorithmIdentifier keyEncAlg;
    if (CMSUtils.isDES(keyEncryptionOID.getId()) || keyEncryptionOID.equals(PKCSObjectIdentifiers.id_alg_CMSRC2wrap))
    {
        keyEncAlg = new AlgorithmIdentifier(keyEncryptionOID, DERNull.INSTANCE);
    }
    else
    {
        keyEncAlg = new AlgorithmIdentifier(keyEncryptionOID);
    }

    AlgorithmIdentifier keyAgreeAlg = new AlgorithmIdentifier(keyAgreementOID, keyEncAlg);

    ASN1Sequence recipients = generateRecipientEncryptedKeys(keyAgreeAlg, keyEncAlg, contentEncryptionKey);
    byte[] userKeyingMaterial = getUserKeyingMaterial(keyAgreeAlg);

    if (userKeyingMaterial != null)
    {
        return new RecipientInfo(new KeyAgreeRecipientInfo(originator, new DEROctetString(userKeyingMaterial),
                keyAgreeAlg, recipients));

    }
    else
    {
        return new RecipientInfo(new KeyAgreeRecipientInfo(originator, null, keyAgreeAlg, recipients));
    }
}
项目:Aki-SSL    文件:KeyAgreeRecipientInfoGenerator.java   
public RecipientInfo generate(GenericKey contentEncryptionKey)
    throws CMSException
{
    OriginatorIdentifierOrKey originator = new OriginatorIdentifierOrKey(
            createOriginatorPublicKey(originatorKeyInfo));

    AlgorithmIdentifier keyEncAlg;
    if (CMSUtils.isDES(keyEncryptionOID.getId()) || keyEncryptionOID.equals(PKCSObjectIdentifiers.id_alg_CMSRC2wrap))
    {
        keyEncAlg = new AlgorithmIdentifier(keyEncryptionOID, DERNull.INSTANCE);
    }
    else
    {
        keyEncAlg = new AlgorithmIdentifier(keyEncryptionOID);
    }

    AlgorithmIdentifier keyAgreeAlg = new AlgorithmIdentifier(keyAgreementOID, keyEncAlg);

    ASN1Sequence recipients = generateRecipientEncryptedKeys(keyAgreeAlg, keyEncAlg, contentEncryptionKey);
    byte[] userKeyingMaterial = getUserKeyingMaterial(keyAgreeAlg);

    if (userKeyingMaterial != null)
    {
        return new RecipientInfo(new KeyAgreeRecipientInfo(originator, new DEROctetString(userKeyingMaterial),
                keyAgreeAlg, recipients));

    }
    else
    {
        return new RecipientInfo(new KeyAgreeRecipientInfo(originator, null, keyAgreeAlg, recipients));
    }
}
项目:irma_future_id    文件:KeyAgreeRecipientInfoGenerator.java   
public RecipientInfo generate(GenericKey contentEncryptionKey)
    throws CMSException
{
    OriginatorIdentifierOrKey originator = new OriginatorIdentifierOrKey(
            createOriginatorPublicKey(originatorKeyInfo));

    ASN1EncodableVector params = new ASN1EncodableVector();
    params.add(keyEncryptionOID);
    params.add(DERNull.INSTANCE);
    AlgorithmIdentifier keyEncAlg = new AlgorithmIdentifier(keyEncryptionOID, DERNull.INSTANCE);
    AlgorithmIdentifier keyAgreeAlg = new AlgorithmIdentifier(keyAgreementOID, keyEncAlg);

    ASN1Sequence recipients = generateRecipientEncryptedKeys(keyAgreeAlg, keyEncAlg, contentEncryptionKey);
    ASN1Encodable userKeyingMaterial = getUserKeyingMaterial(keyAgreeAlg);

    if (userKeyingMaterial != null)
    {
        try
        {
            return new RecipientInfo(new KeyAgreeRecipientInfo(originator, new DEROctetString(userKeyingMaterial),
                keyAgreeAlg, recipients));
        }
        catch (IOException e)
        {
            throw new CMSException("unable to encode userKeyingMaterial: " + e.getMessage(), e);
        }
    }
    else
    {
        return new RecipientInfo(new KeyAgreeRecipientInfo(originator, null,
            keyAgreeAlg, recipients));
    }
}
项目:bc-java    文件:KeyAgreeRecipientInfoGenerator.java   
public RecipientInfo generate(GenericKey contentEncryptionKey)
    throws CMSException
{
    OriginatorIdentifierOrKey originator = new OriginatorIdentifierOrKey(
            createOriginatorPublicKey(originatorKeyInfo));

    ASN1EncodableVector params = new ASN1EncodableVector();
    params.add(keyEncryptionOID);
    params.add(DERNull.INSTANCE);
    AlgorithmIdentifier keyEncAlg = new AlgorithmIdentifier(keyEncryptionOID, DERNull.INSTANCE);
    AlgorithmIdentifier keyAgreeAlg = new AlgorithmIdentifier(keyAgreementOID, keyEncAlg);

    ASN1Sequence recipients = generateRecipientEncryptedKeys(keyAgreeAlg, keyEncAlg, contentEncryptionKey);
    ASN1Encodable userKeyingMaterial = getUserKeyingMaterial(keyAgreeAlg);

    if (userKeyingMaterial != null)
    {
        try
        {
            return new RecipientInfo(new KeyAgreeRecipientInfo(originator, new DEROctetString(userKeyingMaterial),
                keyAgreeAlg, recipients));
        }
        catch (IOException e)
        {
            throw new CMSException("unable to encode userKeyingMaterial: " + e.getMessage(), e);
        }
    }
    else
    {
        return new RecipientInfo(new KeyAgreeRecipientInfo(originator, null,
            keyAgreeAlg, recipients));
    }
}