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

项目: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));
    }
}
项目: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));
    }
}
项目: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));
    }
}
项目: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));
    }
}
项目: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    文件: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    文件: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    文件:PasswordRecipientInformation.java   
PasswordRecipientInformation(
    PasswordRecipientInfo   info,
    AlgorithmIdentifier     messageAlgorithm,
    CMSSecureReadable       secureReadable,
    AuthAttributesProvider  additionalData)
{
    super(info.getKeyEncryptionAlgorithm(), messageAlgorithm, secureReadable, additionalData);

    this.info = info;
    this.rid = new PasswordRecipientId();
}
项目:gwt-crypto    文件:PasswordRecipientInformation.java   
PasswordRecipientInformation(
    PasswordRecipientInfo   info,
    AlgorithmIdentifier     messageAlgorithm,
    CMSSecureReadable       secureReadable,
    AuthAttributesProvider  additionalData)
{
    super(info.getKeyEncryptionAlgorithm(), messageAlgorithm, secureReadable, additionalData);

    this.info = info;
    this.rid = new PasswordRecipientId();
}
项目:gwt-crypto    文件:PasswordRecipientInfoGenerator.java   
public RecipientInfo generate(GenericKey contentEncryptionKey)
    throws CMSException
{
    byte[] iv = new byte[blockSize];     /// TODO: set IV size properly!

    if (random == null)
    {
        random = new SecureRandom();
    }

    random.nextBytes(iv);

    if (keyDerivationAlgorithm == null)
    {
        byte[] salt = new byte[20];

        random.nextBytes(salt);

        keyDerivationAlgorithm = new AlgorithmIdentifier(PKCSObjectIdentifiers.id_PBKDF2, new PBKDF2Params(salt, 1024));
    }

    byte[] derivedKey = calculateDerivedKey(schemeID, keyDerivationAlgorithm, keySize);

    AlgorithmIdentifier kekAlgorithmId = new AlgorithmIdentifier(kekAlgorithm, new DEROctetString(iv));

    byte[] encryptedKeyBytes = generateEncryptedBytes(kekAlgorithmId, derivedKey, contentEncryptionKey);

    ASN1OctetString encryptedKey = new DEROctetString(encryptedKeyBytes);

    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(kekAlgorithm);
    v.add(new DEROctetString(iv));

    AlgorithmIdentifier keyEncryptionAlgorithm = new AlgorithmIdentifier(
        PKCSObjectIdentifiers.id_alg_PWRI_KEK, new DERSequence(v));

    return new RecipientInfo(new PasswordRecipientInfo(keyDerivationAlgorithm,
        keyEncryptionAlgorithm, encryptedKey));
}
项目:Aki-SSL    文件:PasswordRecipientInformation.java   
PasswordRecipientInformation(
    PasswordRecipientInfo   info,
    AlgorithmIdentifier     messageAlgorithm,
    CMSSecureReadable       secureReadable,
    AuthAttributesProvider  additionalData)
{
    super(info.getKeyEncryptionAlgorithm(), messageAlgorithm, secureReadable, additionalData);

    this.info = info;
    this.rid = new PasswordRecipientId();
}
项目:Aki-SSL    文件:PasswordRecipientInfoGenerator.java   
public RecipientInfo generate(GenericKey contentEncryptionKey)
    throws CMSException
{
    byte[] iv = new byte[blockSize];     /// TODO: set IV size properly!

    if (random == null)
    {
        random = new SecureRandom();
    }

    random.nextBytes(iv);

    if (keyDerivationAlgorithm == null)
    {
        byte[] salt = new byte[20];

        random.nextBytes(salt);

        keyDerivationAlgorithm = new AlgorithmIdentifier(PKCSObjectIdentifiers.id_PBKDF2, new PBKDF2Params(salt, 1024));
    }

    byte[] derivedKey = calculateDerivedKey(schemeID, keyDerivationAlgorithm, keySize);

    AlgorithmIdentifier kekAlgorithmId = new AlgorithmIdentifier(kekAlgorithm, new DEROctetString(iv));

    byte[] encryptedKeyBytes = generateEncryptedBytes(kekAlgorithmId, derivedKey, contentEncryptionKey);

    ASN1OctetString encryptedKey = new DEROctetString(encryptedKeyBytes);

    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(kekAlgorithm);
    v.add(new DEROctetString(iv));

    AlgorithmIdentifier keyEncryptionAlgorithm = new AlgorithmIdentifier(
        PKCSObjectIdentifiers.id_alg_PWRI_KEK, new DERSequence(v));

    return new RecipientInfo(new PasswordRecipientInfo(keyDerivationAlgorithm,
        keyEncryptionAlgorithm, encryptedKey));
}
项目:irma_future_id    文件:PasswordRecipientInformation.java   
PasswordRecipientInformation(
    PasswordRecipientInfo   info,
    AlgorithmIdentifier     messageAlgorithm,
    CMSSecureReadable       secureReadable,
    AuthAttributesProvider  additionalData)
{
    super(info.getKeyEncryptionAlgorithm(), messageAlgorithm, secureReadable, additionalData);

    this.info = info;
    this.rid = new PasswordRecipientId();
}
项目:irma_future_id    文件:PasswordRecipientInformation.java   
PasswordRecipientInformation(
    PasswordRecipientInfo   info,
    AlgorithmIdentifier     messageAlgorithm,
    CMSSecureReadable       secureReadable,
    AuthAttributesProvider  additionalData)
{
    super(info.getKeyEncryptionAlgorithm(), messageAlgorithm, secureReadable, additionalData);

    this.info = info;
    this.rid = new PasswordRecipientId();
}
项目:bc-java    文件:PasswordRecipientInformation.java   
PasswordRecipientInformation(
    PasswordRecipientInfo   info,
    AlgorithmIdentifier     messageAlgorithm,
    CMSSecureReadable       secureReadable,
    AuthAttributesProvider  additionalData)
{
    super(info.getKeyEncryptionAlgorithm(), messageAlgorithm, secureReadable, additionalData);

    this.info = info;
    this.rid = new PasswordRecipientId();
}
项目:bc-java    文件:PasswordRecipientInformation.java   
PasswordRecipientInformation(
    PasswordRecipientInfo   info,
    AlgorithmIdentifier     messageAlgorithm,
    CMSSecureReadable       secureReadable,
    AuthAttributesProvider  additionalData)
{
    super(info.getKeyEncryptionAlgorithm(), messageAlgorithm, secureReadable, additionalData);

    this.info = info;
    this.rid = new PasswordRecipientId();
}