Java 类org.bouncycastle.asn1.crmf.EncryptedValue 实例源码

项目:ipack    文件:CertifiedKeyPair.java   
private CertifiedKeyPair(ASN1Sequence seq)
{
    certOrEncCert = CertOrEncCert.getInstance(seq.getObjectAt(0));

    if (seq.size() >= 2)
    {
        if (seq.size() == 2)
        {
            ASN1TaggedObject tagged = ASN1TaggedObject.getInstance(seq.getObjectAt(1));
            if (tagged.getTagNo() == 0)
            {
                privateKey = EncryptedValue.getInstance(tagged.getObject());
            }
            else
            {
                publicationInfo = PKIPublicationInfo.getInstance(tagged.getObject());
            }
        }
        else
        {
            privateKey = EncryptedValue.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(1)));
            publicationInfo = PKIPublicationInfo.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(2)));
        }
    }
}
项目:gwt-crypto    文件:CertifiedKeyPair.java   
private CertifiedKeyPair(ASN1Sequence seq)
{
    certOrEncCert = CertOrEncCert.getInstance(seq.getObjectAt(0));

    if (seq.size() >= 2)
    {
        if (seq.size() == 2)
        {
            ASN1TaggedObject tagged = ASN1TaggedObject.getInstance(seq.getObjectAt(1));
            if (tagged.getTagNo() == 0)
            {
                privateKey = EncryptedValue.getInstance(tagged.getObject());
            }
            else
            {
                publicationInfo = PKIPublicationInfo.getInstance(tagged.getObject());
            }
        }
        else
        {
            privateKey = EncryptedValue.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(1)));
            publicationInfo = PKIPublicationInfo.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(2)));
        }
    }
}
项目:Aki-SSL    文件:CertifiedKeyPair.java   
private CertifiedKeyPair(ASN1Sequence seq)
{
    certOrEncCert = CertOrEncCert.getInstance(seq.getObjectAt(0));

    if (seq.size() >= 2)
    {
        if (seq.size() == 2)
        {
            ASN1TaggedObject tagged = ASN1TaggedObject.getInstance(seq.getObjectAt(1));
            if (tagged.getTagNo() == 0)
            {
                privateKey = EncryptedValue.getInstance(tagged.getObject());
            }
            else
            {
                publicationInfo = PKIPublicationInfo.getInstance(tagged.getObject());
            }
        }
        else
        {
            privateKey = EncryptedValue.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(1)));
            publicationInfo = PKIPublicationInfo.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(2)));
        }
    }
}
项目:TinyTravelTracker    文件:CertifiedKeyPair.java   
private CertifiedKeyPair(ASN1Sequence seq)
{
    certOrEncCert = CertOrEncCert.getInstance(seq.getObjectAt(0));

    if (seq.size() >= 2)
    {
        if (seq.size() == 2)
        {
            ASN1TaggedObject tagged = ASN1TaggedObject.getInstance(seq.getObjectAt(1));
            if (tagged.getTagNo() == 0)
            {
                privateKey = EncryptedValue.getInstance(tagged.getObject());
            }
            else
            {
                publicationInfo = PKIPublicationInfo.getInstance(tagged.getObject());
            }
        }
        else
        {
            privateKey = EncryptedValue.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(1)));
            publicationInfo = PKIPublicationInfo.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(2)));
        }
    }
}
项目:CryptMeme    文件:CertifiedKeyPair.java   
private CertifiedKeyPair(ASN1Sequence seq)
{
    certOrEncCert = CertOrEncCert.getInstance(seq.getObjectAt(0));

    if (seq.size() >= 2)
    {
        if (seq.size() == 2)
        {
            ASN1TaggedObject tagged = ASN1TaggedObject.getInstance(seq.getObjectAt(1));
            if (tagged.getTagNo() == 0)
            {
                privateKey = EncryptedValue.getInstance(tagged.getObject());
            }
            else
            {
                publicationInfo = PKIPublicationInfo.getInstance(tagged.getObject());
            }
        }
        else
        {
            privateKey = EncryptedValue.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(1)));
            publicationInfo = PKIPublicationInfo.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(2)));
        }
    }
}
项目:irma_future_id    文件:AllTests.java   
public void testEncryptedValue()
    throws Exception
{
    KeyPairGenerator kGen = KeyPairGenerator.getInstance("RSA", BC);

    kGen.initialize(512);

    KeyPair kp = kGen.generateKeyPair();
    X509Certificate cert = makeV1Certificate(kp, "CN=Test", kp, "CN=Test");

    JcaEncryptedValueBuilder build = new JcaEncryptedValueBuilder(new JceAsymmetricKeyWrapper(cert.getPublicKey()).setProvider(BC), new JceCRMFEncryptorBuilder(CMSAlgorithm.AES128_CBC).setProvider(BC).build());
    EncryptedValue value = build.build(cert);
    ValueDecryptorGenerator decGen = new JceAsymmetricValueDecryptorGenerator(kp.getPrivate()).setProvider(BC);

    // try direct
    encryptedValueParserTest(value, decGen, cert);

    // try indirect
    encryptedValueParserTest(EncryptedValue.getInstance(value.getEncoded()), decGen, cert);
}
项目:irma_future_id    文件:AllTests.java   
public void testEncryptedValuePassphrase()
    throws Exception
{
    char[] passphrase = PASSPHRASE.toCharArray();
    KeyPairGenerator kGen = KeyPairGenerator.getInstance("RSA", BC);

    kGen.initialize(512);

    KeyPair kp = kGen.generateKeyPair();
    X509Certificate cert = makeV1Certificate(kp, "CN=Test", kp, "CN=Test");

    EncryptedValueBuilder build = new EncryptedValueBuilder(new JceAsymmetricKeyWrapper(cert.getPublicKey()).setProvider(BC), new JceCRMFEncryptorBuilder(CMSAlgorithm.AES128_CBC).setProvider(BC).build());
    EncryptedValue value = build.build(passphrase);
    ValueDecryptorGenerator decGen = new JceAsymmetricValueDecryptorGenerator(kp.getPrivate()).setProvider(BC);

    // try direct
    encryptedValuePassphraseParserTest(value, null, decGen, cert);

    // try indirect
    encryptedValuePassphraseParserTest(EncryptedValue.getInstance(value.getEncoded()), null, decGen, cert);
}
项目:irma_future_id    文件:AllTests.java   
public void testEncryptedValuePassphraseWithPadding()
    throws Exception
{
    char[] passphrase = PASSPHRASE.toCharArray();
    KeyPairGenerator kGen = KeyPairGenerator.getInstance("RSA", BC);

    kGen.initialize(512);

    KeyPair kp = kGen.generateKeyPair();
    X509Certificate cert = makeV1Certificate(kp, "CN=Test", kp, "CN=Test");

    FixedLengthMGF1Padder mgf1Padder = new FixedLengthMGF1Padder(200, new SecureRandom());
    EncryptedValueBuilder build = new EncryptedValueBuilder(new JceAsymmetricKeyWrapper(cert.getPublicKey()).setProvider(BC), new JceCRMFEncryptorBuilder(CMSAlgorithm.AES128_CBC).setProvider(BC).build(), mgf1Padder);
    EncryptedValue value = build.build(passphrase);
    ValueDecryptorGenerator decGen = new JceAsymmetricValueDecryptorGenerator(kp.getPrivate()).setProvider(BC);

    // try direct
    encryptedValuePassphraseParserTest(value, mgf1Padder, decGen, cert);

    // try indirect
    encryptedValuePassphraseParserTest(EncryptedValue.getInstance(value.getEncoded()), mgf1Padder, decGen, cert);
}
项目:irma_future_id    文件:AllTests.java   
public void testEncryptedValue()
    throws Exception
{
    KeyPairGenerator kGen = KeyPairGenerator.getInstance("RSA", BC);

    kGen.initialize(512);

    KeyPair kp = kGen.generateKeyPair();
    X509Certificate cert = makeV1Certificate(kp, "CN=Test", kp, "CN=Test");

    JcaEncryptedValueBuilder build = new JcaEncryptedValueBuilder(new JceAsymmetricKeyWrapper(cert.getPublicKey()).setProvider(BC), new JceCRMFEncryptorBuilder(CMSAlgorithm.AES128_CBC).setProvider(BC).build());
    EncryptedValue value = build.build(cert);
    ValueDecryptorGenerator decGen = new JceAsymmetricValueDecryptorGenerator(kp.getPrivate()).setProvider(BC);

    // try direct
    encryptedValueParserTest(value, decGen, cert);

    // try indirect
    encryptedValueParserTest(EncryptedValue.getInstance(value.getEncoded()), decGen, cert);
}
项目:irma_future_id    文件:AllTests.java   
public void testEncryptedValuePassphrase()
    throws Exception
{
    char[] passphrase = PASSPHRASE.toCharArray();
    KeyPairGenerator kGen = KeyPairGenerator.getInstance("RSA", BC);

    kGen.initialize(512);

    KeyPair kp = kGen.generateKeyPair();
    X509Certificate cert = makeV1Certificate(kp, "CN=Test", kp, "CN=Test");

    EncryptedValueBuilder build = new EncryptedValueBuilder(new JceAsymmetricKeyWrapper(cert.getPublicKey()).setProvider(BC), new JceCRMFEncryptorBuilder(CMSAlgorithm.AES128_CBC).setProvider(BC).build());
    EncryptedValue value = build.build(passphrase);
    ValueDecryptorGenerator decGen = new JceAsymmetricValueDecryptorGenerator(kp.getPrivate()).setProvider(BC);

    // try direct
    encryptedValuePassphraseParserTest(value, null, decGen, cert);

    // try indirect
    encryptedValuePassphraseParserTest(EncryptedValue.getInstance(value.getEncoded()), null, decGen, cert);
}
项目:irma_future_id    文件:AllTests.java   
public void testEncryptedValuePassphraseWithPadding()
    throws Exception
{
    char[] passphrase = PASSPHRASE.toCharArray();
    KeyPairGenerator kGen = KeyPairGenerator.getInstance("RSA", BC);

    kGen.initialize(512);

    KeyPair kp = kGen.generateKeyPair();
    X509Certificate cert = makeV1Certificate(kp, "CN=Test", kp, "CN=Test");

    FixedLengthMGF1Padder mgf1Padder = new FixedLengthMGF1Padder(200, new SecureRandom());
    EncryptedValueBuilder build = new EncryptedValueBuilder(new JceAsymmetricKeyWrapper(cert.getPublicKey()).setProvider(BC), new JceCRMFEncryptorBuilder(CMSAlgorithm.AES128_CBC).setProvider(BC).build(), mgf1Padder);
    EncryptedValue value = build.build(passphrase);
    ValueDecryptorGenerator decGen = new JceAsymmetricValueDecryptorGenerator(kp.getPrivate()).setProvider(BC);

    // try direct
    encryptedValuePassphraseParserTest(value, mgf1Padder, decGen, cert);

    // try indirect
    encryptedValuePassphraseParserTest(EncryptedValue.getInstance(value.getEncoded()), mgf1Padder, decGen, cert);
}
项目:irma_future_id    文件:CertifiedKeyPair.java   
private CertifiedKeyPair(ASN1Sequence seq)
{
    certOrEncCert = CertOrEncCert.getInstance(seq.getObjectAt(0));

    if (seq.size() >= 2)
    {
        if (seq.size() == 2)
        {
            ASN1TaggedObject tagged = ASN1TaggedObject.getInstance(seq.getObjectAt(1));
            if (tagged.getTagNo() == 0)
            {
                privateKey = EncryptedValue.getInstance(tagged.getObject());
            }
            else
            {
                publicationInfo = PKIPublicationInfo.getInstance(tagged.getObject());
            }
        }
        else
        {
            privateKey = EncryptedValue.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(1)));
            publicationInfo = PKIPublicationInfo.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(2)));
        }
    }
}
项目:bc-java    文件:AllTests.java   
public void testEncryptedValue()
    throws Exception
{
    KeyPairGenerator kGen = KeyPairGenerator.getInstance("RSA", BC);

    kGen.initialize(512);

    KeyPair kp = kGen.generateKeyPair();
    X509Certificate cert = makeV1Certificate(kp, "CN=Test", kp, "CN=Test");

    JcaEncryptedValueBuilder build = new JcaEncryptedValueBuilder(new JceAsymmetricKeyWrapper(cert.getPublicKey()).setProvider(BC), new JceCRMFEncryptorBuilder(CMSAlgorithm.AES128_CBC).setProvider(BC).build());
    EncryptedValue value = build.build(cert);
    ValueDecryptorGenerator decGen = new JceAsymmetricValueDecryptorGenerator(kp.getPrivate()).setProvider(BC);

    // try direct
    encryptedValueParserTest(value, decGen, cert);

    // try indirect
    encryptedValueParserTest(EncryptedValue.getInstance(value.getEncoded()), decGen, cert);
}
项目:bc-java    文件:AllTests.java   
public void testEncryptedValuePassphrase()
    throws Exception
{
    char[] passphrase = PASSPHRASE.toCharArray();
    KeyPairGenerator kGen = KeyPairGenerator.getInstance("RSA", BC);

    kGen.initialize(512);

    KeyPair kp = kGen.generateKeyPair();
    X509Certificate cert = makeV1Certificate(kp, "CN=Test", kp, "CN=Test");

    EncryptedValueBuilder build = new EncryptedValueBuilder(new JceAsymmetricKeyWrapper(cert.getPublicKey()).setProvider(BC), new JceCRMFEncryptorBuilder(CMSAlgorithm.AES128_CBC).setProvider(BC).build());
    EncryptedValue value = build.build(passphrase);
    ValueDecryptorGenerator decGen = new JceAsymmetricValueDecryptorGenerator(kp.getPrivate()).setProvider(BC);

    // try direct
    encryptedValuePassphraseParserTest(value, null, decGen, cert);

    // try indirect
    encryptedValuePassphraseParserTest(EncryptedValue.getInstance(value.getEncoded()), null, decGen, cert);
}
项目:bc-java    文件:AllTests.java   
public void testEncryptedValuePassphraseWithPadding()
    throws Exception
{
    char[] passphrase = PASSPHRASE.toCharArray();
    KeyPairGenerator kGen = KeyPairGenerator.getInstance("RSA", BC);

    kGen.initialize(512);

    KeyPair kp = kGen.generateKeyPair();
    X509Certificate cert = makeV1Certificate(kp, "CN=Test", kp, "CN=Test");

    FixedLengthMGF1Padder mgf1Padder = new FixedLengthMGF1Padder(200, new SecureRandom());
    EncryptedValueBuilder build = new EncryptedValueBuilder(new JceAsymmetricKeyWrapper(cert.getPublicKey()).setProvider(BC), new JceCRMFEncryptorBuilder(CMSAlgorithm.AES128_CBC).setProvider(BC).build(), mgf1Padder);
    EncryptedValue value = build.build(passphrase);
    ValueDecryptorGenerator decGen = new JceAsymmetricValueDecryptorGenerator(kp.getPrivate()).setProvider(BC);

    // try direct
    encryptedValuePassphraseParserTest(value, mgf1Padder, decGen, cert);

    // try indirect
    encryptedValuePassphraseParserTest(EncryptedValue.getInstance(value.getEncoded()), mgf1Padder, decGen, cert);
}
项目:bc-java    文件:AllTests.java   
public void testEncryptedValue()
    throws Exception
{
    KeyPairGenerator kGen = KeyPairGenerator.getInstance("RSA", BC);

    kGen.initialize(512);

    KeyPair kp = kGen.generateKeyPair();
    X509Certificate cert = makeV1Certificate(kp, "CN=Test", kp, "CN=Test");

    JcaEncryptedValueBuilder build = new JcaEncryptedValueBuilder(new JceAsymmetricKeyWrapper(cert.getPublicKey()).setProvider(BC), new JceCRMFEncryptorBuilder(CMSAlgorithm.AES128_CBC).setProvider(BC).build());
    EncryptedValue value = build.build(cert);
    ValueDecryptorGenerator decGen = new JceAsymmetricValueDecryptorGenerator(kp.getPrivate()).setProvider(BC);

    // try direct
    encryptedValueParserTest(value, decGen, cert);

    // try indirect
    encryptedValueParserTest(EncryptedValue.getInstance(value.getEncoded()), decGen, cert);
}
项目:bc-java    文件:AllTests.java   
public void testEncryptedValuePassphrase()
    throws Exception
{
    char[] passphrase = PASSPHRASE.toCharArray();
    KeyPairGenerator kGen = KeyPairGenerator.getInstance("RSA", BC);

    kGen.initialize(512);

    KeyPair kp = kGen.generateKeyPair();
    X509Certificate cert = makeV1Certificate(kp, "CN=Test", kp, "CN=Test");

    EncryptedValueBuilder build = new EncryptedValueBuilder(new JceAsymmetricKeyWrapper(cert.getPublicKey()).setProvider(BC), new JceCRMFEncryptorBuilder(CMSAlgorithm.AES128_CBC).setProvider(BC).build());
    EncryptedValue value = build.build(passphrase);
    ValueDecryptorGenerator decGen = new JceAsymmetricValueDecryptorGenerator(kp.getPrivate()).setProvider(BC);

    // try direct
    encryptedValuePassphraseParserTest(value, null, decGen, cert);

    // try indirect
    encryptedValuePassphraseParserTest(EncryptedValue.getInstance(value.getEncoded()), null, decGen, cert);
}
项目:bc-java    文件:AllTests.java   
public void testEncryptedValuePassphraseWithPadding()
    throws Exception
{
    char[] passphrase = PASSPHRASE.toCharArray();
    KeyPairGenerator kGen = KeyPairGenerator.getInstance("RSA", BC);

    kGen.initialize(512);

    KeyPair kp = kGen.generateKeyPair();
    X509Certificate cert = makeV1Certificate(kp, "CN=Test", kp, "CN=Test");

    FixedLengthMGF1Padder mgf1Padder = new FixedLengthMGF1Padder(200, new SecureRandom());
    EncryptedValueBuilder build = new EncryptedValueBuilder(new JceAsymmetricKeyWrapper(cert.getPublicKey()).setProvider(BC), new JceCRMFEncryptorBuilder(CMSAlgorithm.AES128_CBC).setProvider(BC).build(), mgf1Padder);
    EncryptedValue value = build.build(passphrase);
    ValueDecryptorGenerator decGen = new JceAsymmetricValueDecryptorGenerator(kp.getPrivate()).setProvider(BC);

    // try direct
    encryptedValuePassphraseParserTest(value, mgf1Padder, decGen, cert);

    // try indirect
    encryptedValuePassphraseParserTest(EncryptedValue.getInstance(value.getEncoded()), mgf1Padder, decGen, cert);
}
项目:bc-java    文件:CertifiedKeyPair.java   
private CertifiedKeyPair(ASN1Sequence seq)
{
    certOrEncCert = CertOrEncCert.getInstance(seq.getObjectAt(0));

    if (seq.size() >= 2)
    {
        if (seq.size() == 2)
        {
            ASN1TaggedObject tagged = ASN1TaggedObject.getInstance(seq.getObjectAt(1));
            if (tagged.getTagNo() == 0)
            {
                privateKey = EncryptedValue.getInstance(tagged.getObject());
            }
            else
            {
                publicationInfo = PKIPublicationInfo.getInstance(tagged.getObject());
            }
        }
        else
        {
            privateKey = EncryptedValue.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(1)));
            publicationInfo = PKIPublicationInfo.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(2)));
        }
    }
}
项目:ipack    文件:EncryptedValueBuilder.java   
/**
 * Build an EncryptedValue structure containing the certificate contained in
 * the passed in holder.
 *
 * @param holder  a holder containing a certificate.
 * @return an EncryptedValue containing the encrypted certificate.
 * @throws CRMFException on a failure to encrypt the data, or wrap the symmetric key for this value.
 */
public EncryptedValue build(X509CertificateHolder holder)
    throws CRMFException
{
    try
    {
        return encryptData(padData(holder.getEncoded()));
    }
    catch (IOException e)
    {
        throw new CRMFException("cannot encode certificate: " + e.getMessage(), e);
    }
}
项目:ipack    文件:CertOrEncCert.java   
private CertOrEncCert(ASN1TaggedObject tagged)
{
    if (tagged.getTagNo() == 0)
    {
        certificate = CMPCertificate.getInstance(tagged.getObject());
    }
    else if (tagged.getTagNo() == 1)
    {
        encryptedCert = EncryptedValue.getInstance(tagged.getObject());
    }
    else
    {
        throw new IllegalArgumentException("unknown tag: " + tagged.getTagNo());
    }
}
项目:ipack    文件:CertOrEncCert.java   
public CertOrEncCert(EncryptedValue encryptedCert)
{
    if (encryptedCert == null)
    {
        throw new IllegalArgumentException("'encryptedCert' cannot be null");
    }

    this.encryptedCert = encryptedCert;
}
项目:ipack    文件:CertifiedKeyPair.java   
public CertifiedKeyPair(
    CertOrEncCert certOrEncCert,
    EncryptedValue privateKey,
    PKIPublicationInfo  publicationInfo
    )
{
    if (certOrEncCert == null)
    {
        throw new IllegalArgumentException("'certOrEncCert' cannot be null");
    }

    this.certOrEncCert = certOrEncCert;
    this.privateKey = privateKey;
    this.publicationInfo = publicationInfo;
}
项目:gwt-crypto    文件:EncryptedValueBuilder.java   
/**
 * Build an EncryptedValue structure containing the certificate contained in
 * the passed in holder.
 *
 * @param holder  a holder containing a certificate.
 * @return an EncryptedValue containing the encrypted certificate.
 * @throws CRMFException on a failure to encrypt the data, or wrap the symmetric key for this value.
 */
public EncryptedValue build(X509CertificateHolder holder)
    throws CRMFException
{
    try
    {
        return encryptData(padData(holder.getEncoded()));
    }
    catch (IOException e)
    {
        throw new CRMFException("cannot encode certificate: " + e.getMessage(), e);
    }
}
项目:gwt-crypto    文件:CertOrEncCert.java   
private CertOrEncCert(ASN1TaggedObject tagged)
{
    if (tagged.getTagNo() == 0)
    {
        certificate = CMPCertificate.getInstance(tagged.getObject());
    }
    else if (tagged.getTagNo() == 1)
    {
        encryptedCert = EncryptedValue.getInstance(tagged.getObject());
    }
    else
    {
        throw new IllegalArgumentException("unknown tag: " + tagged.getTagNo());
    }
}
项目:gwt-crypto    文件:CertOrEncCert.java   
public CertOrEncCert(EncryptedValue encryptedCert)
{
    if (encryptedCert == null)
    {
        throw new IllegalArgumentException("'encryptedCert' cannot be null");
    }

    this.encryptedCert = encryptedCert;
}
项目:gwt-crypto    文件:CertifiedKeyPair.java   
public CertifiedKeyPair(
    CertOrEncCert certOrEncCert,
    EncryptedValue privateKey,
    PKIPublicationInfo  publicationInfo
    )
{
    if (certOrEncCert == null)
    {
        throw new IllegalArgumentException("'certOrEncCert' cannot be null");
    }

    this.certOrEncCert = certOrEncCert;
    this.privateKey = privateKey;
    this.publicationInfo = publicationInfo;
}
项目:Aki-SSL    文件:EncryptedValueBuilder.java   
/**
 * Build an EncryptedValue structure containing the certificate contained in
 * the passed in holder.
 *
 * @param holder  a holder containing a certificate.
 * @return an EncryptedValue containing the encrypted certificate.
 * @throws CRMFException on a failure to encrypt the data, or wrap the symmetric key for this value.
 */
public EncryptedValue build(X509CertificateHolder holder)
    throws CRMFException
{
    try
    {
        return encryptData(padData(holder.getEncoded()));
    }
    catch (IOException e)
    {
        throw new CRMFException("cannot encode certificate: " + e.getMessage(), e);
    }
}
项目:Aki-SSL    文件:CertOrEncCert.java   
private CertOrEncCert(ASN1TaggedObject tagged)
{
    if (tagged.getTagNo() == 0)
    {
        certificate = CMPCertificate.getInstance(tagged.getObject());
    }
    else if (tagged.getTagNo() == 1)
    {
        encryptedCert = EncryptedValue.getInstance(tagged.getObject());
    }
    else
    {
        throw new IllegalArgumentException("unknown tag: " + tagged.getTagNo());
    }
}
项目:Aki-SSL    文件:CertOrEncCert.java   
public CertOrEncCert(EncryptedValue encryptedCert)
{
    if (encryptedCert == null)
    {
        throw new IllegalArgumentException("'encryptedCert' cannot be null");
    }

    this.encryptedCert = encryptedCert;
}
项目:Aki-SSL    文件:CertifiedKeyPair.java   
public CertifiedKeyPair(
    CertOrEncCert certOrEncCert,
    EncryptedValue privateKey,
    PKIPublicationInfo  publicationInfo
    )
{
    if (certOrEncCert == null)
    {
        throw new IllegalArgumentException("'certOrEncCert' cannot be null");
    }

    this.certOrEncCert = certOrEncCert;
    this.privateKey = privateKey;
    this.publicationInfo = publicationInfo;
}
项目:TinyTravelTracker    文件:CertOrEncCert.java   
private CertOrEncCert(ASN1TaggedObject tagged)
{
    if (tagged.getTagNo() == 0)
    {
        certificate = CMPCertificate.getInstance(tagged.getObject());
    }
    else if (tagged.getTagNo() == 1)
    {
        encryptedCert = EncryptedValue.getInstance(tagged.getObject());
    }
    else
    {
        throw new IllegalArgumentException("unknown tag: " + tagged.getTagNo());
    }
}
项目:TinyTravelTracker    文件:CertOrEncCert.java   
public CertOrEncCert(EncryptedValue encryptedCert)
{
    if (encryptedCert == null)
    {
        throw new IllegalArgumentException("'encryptedCert' cannot be null");
    }

    this.encryptedCert = encryptedCert;
}
项目:TinyTravelTracker    文件:CertifiedKeyPair.java   
public CertifiedKeyPair(
    CertOrEncCert certOrEncCert,
    EncryptedValue privateKey,
    PKIPublicationInfo  publicationInfo
    )
{
    if (certOrEncCert == null)
    {
        throw new IllegalArgumentException("'certOrEncCert' cannot be null");
    }

    this.certOrEncCert = certOrEncCert;
    this.privateKey = privateKey;
    this.publicationInfo = publicationInfo;
}
项目:CryptMeme    文件:CertOrEncCert.java   
private CertOrEncCert(ASN1TaggedObject tagged)
{
    if (tagged.getTagNo() == 0)
    {
        certificate = CMPCertificate.getInstance(tagged.getObject());
    }
    else if (tagged.getTagNo() == 1)
    {
        encryptedCert = EncryptedValue.getInstance(tagged.getObject());
    }
    else
    {
        throw new IllegalArgumentException("unknown tag: " + tagged.getTagNo());
    }
}
项目:CryptMeme    文件:CertOrEncCert.java   
public CertOrEncCert(EncryptedValue encryptedCert)
{
    if (encryptedCert == null)
    {
        throw new IllegalArgumentException("'encryptedCert' cannot be null");
    }

    this.encryptedCert = encryptedCert;
}
项目:CryptMeme    文件:CertifiedKeyPair.java   
public CertifiedKeyPair(
    CertOrEncCert certOrEncCert,
    EncryptedValue privateKey,
    PKIPublicationInfo  publicationInfo
    )
{
    if (certOrEncCert == null)
    {
        throw new IllegalArgumentException("'certOrEncCert' cannot be null");
    }

    this.certOrEncCert = certOrEncCert;
    this.privateKey = privateKey;
    this.publicationInfo = publicationInfo;
}
项目:irma_future_id    文件:EncryptedValueBuilder.java   
/**
 * Build an EncryptedValue structure containing the certificate contained in
 * the passed in holder.
 *
 * @param holder  a holder containing a certificate.
 * @return an EncryptedValue containing the encrypted certificate.
 * @throws CRMFException on a failure to encrypt the data, or wrap the symmetric key for this value.
 */
public EncryptedValue build(X509CertificateHolder holder)
    throws CRMFException
{
    try
    {
        return encryptData(padData(holder.getEncoded()));
    }
    catch (IOException e)
    {
        throw new CRMFException("cannot encode certificate: " + e.getMessage(), e);
    }
}
项目:irma_future_id    文件:AllTests.java   
private void encryptedValueParserTest(EncryptedValue value, ValueDecryptorGenerator decGen, X509Certificate cert)
    throws Exception
{
    EncryptedValueParser  parser = new EncryptedValueParser(value);

    X509CertificateHolder holder = parser.readCertificateHolder(decGen);

    assertTrue(Arrays.areEqual(cert.getEncoded(), holder.getEncoded()));
}
项目:irma_future_id    文件:AllTests.java   
private void encryptedValuePassphraseParserTest(EncryptedValue value, EncryptedValuePadder padder, ValueDecryptorGenerator decGen, X509Certificate cert)
    throws Exception
{
    EncryptedValueParser  parser = new EncryptedValueParser(value, padder);

    assertTrue(Arrays.areEqual(PASSPHRASE.toCharArray(), parser.readPassphrase(decGen)));
}