Java 类org.bouncycastle.asn1.oiw.OIWObjectIdentifiers 实例源码

项目:ipack    文件:SHA1.java   
public void configure(ConfigurableProvider provider)
{
    provider.addAlgorithm("MessageDigest.SHA-1", PREFIX + "$Digest");
    provider.addAlgorithm("Alg.Alias.MessageDigest.SHA1", "SHA-1");
    provider.addAlgorithm("Alg.Alias.MessageDigest.SHA", "SHA-1");
    provider.addAlgorithm("Alg.Alias.MessageDigest." + OIWObjectIdentifiers.idSHA1, "SHA-1");

    addHMACAlgorithm(provider, "SHA1", PREFIX + "$HashMac", PREFIX + "$KeyGenerator");
    addHMACAlias(provider, "SHA1", PKCSObjectIdentifiers.id_hmacWithSHA1);
    addHMACAlias(provider, "SHA1", IANAObjectIdentifiers.hmacSHA1);

    provider.addAlgorithm("Mac.PBEWITHHMACSHA", PREFIX + "$SHA1Mac");
    provider.addAlgorithm("Mac.PBEWITHHMACSHA1", PREFIX + "$SHA1Mac");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHHMACSHA", "PBEWITHHMACSHA1");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + OIWObjectIdentifiers.idSHA1, "PBEWITHHMACSHA1");
    provider.addAlgorithm("Alg.Alias.Mac." + OIWObjectIdentifiers.idSHA1, "PBEWITHHMACSHA");

    provider.addAlgorithm("SecretKeyFactory.PBEWITHHMACSHA1", PREFIX + "$PBEWithMacKeyFactory");
    provider.addAlgorithm("SecretKeyFactory.PBKDF2WithHmacSHA1", PREFIX + "$PBKDF2WithHmacSHA1UTF8");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.id_PBKDF2, "PBKDF2WithHmacSHA1");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBKDF2WithHmacSHA1AndUTF8", "PBKDF2WithHmacSHA1");
    provider.addAlgorithm("SecretKeyFactory.PBKDF2WithHmacSHA1And8BIT", PREFIX + "$PBKDF2WithHmacSHA18BIT");
}
项目:ipack    文件:ElGamal.java   
public void configure(ConfigurableProvider provider)
{
    provider.addAlgorithm("AlgorithmParameterGenerator.ELGAMAL", PREFIX + "AlgorithmParameterGeneratorSpi");
    provider.addAlgorithm("AlgorithmParameterGenerator.ElGamal", PREFIX + "AlgorithmParameterGeneratorSpi");
    provider.addAlgorithm("AlgorithmParameters.ELGAMAL", PREFIX + "AlgorithmParametersSpi");
    provider.addAlgorithm("AlgorithmParameters.ElGamal", PREFIX + "AlgorithmParametersSpi");

    provider.addAlgorithm("Cipher.ELGAMAL", PREFIX + "CipherSpi$NoPadding");
    provider.addAlgorithm("Cipher.ElGamal", PREFIX + "CipherSpi$NoPadding");
    provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/ECB/PKCS1PADDING", "ELGAMAL/PKCS1");
    provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/NONE/PKCS1PADDING", "ELGAMAL/PKCS1");
    provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/NONE/NOPADDING", "ELGAMAL");

    provider.addAlgorithm("Cipher.ELGAMAL/PKCS1", PREFIX + "CipherSpi$PKCS1v1_5Padding");
    provider.addAlgorithm("KeyFactory.ELGAMAL", PREFIX + "KeyFactorySpi");
    provider.addAlgorithm("KeyFactory.ElGamal", PREFIX + "KeyFactorySpi");

    provider.addAlgorithm("KeyPairGenerator.ELGAMAL", PREFIX + "KeyPairGeneratorSpi");
    provider.addAlgorithm("KeyPairGenerator.ElGamal", PREFIX + "KeyPairGeneratorSpi");

    AsymmetricKeyInfoConverter keyFact = new KeyFactorySpi();

    registerOid(provider, OIWObjectIdentifiers.elGamalAlgorithm, "ELGAMAL", keyFact);
    registerOidAlgorithmParameters(provider, OIWObjectIdentifiers.elGamalAlgorithm, "ELGAMAL");
}
项目:ipack    文件:KeyFactorySpi.java   
public PrivateKey generatePrivate(PrivateKeyInfo info)
    throws IOException
{
    ASN1ObjectIdentifier algOid = info.getPrivateKeyAlgorithm().getAlgorithm();

    if (algOid.equals(PKCSObjectIdentifiers.dhKeyAgreement))
    {
        return new BCElGamalPrivateKey(info);
    }
    else if (algOid.equals(X9ObjectIdentifiers.dhpublicnumber))
    {
        return new BCElGamalPrivateKey(info);
    }
    else if (algOid.equals(OIWObjectIdentifiers.elGamalAlgorithm))
    {
        return new BCElGamalPrivateKey(info);
    }
    else
    {
        throw new IOException("algorithm identifier " + algOid + " in key not recognised");
    }
}
项目:ipack    文件:KeyFactorySpi.java   
public PublicKey generatePublic(SubjectPublicKeyInfo info)
    throws IOException
{
    ASN1ObjectIdentifier algOid = info.getAlgorithm().getAlgorithm();

    if (algOid.equals(PKCSObjectIdentifiers.dhKeyAgreement))
    {
        return new BCElGamalPublicKey(info);
    }
    else if (algOid.equals(X9ObjectIdentifiers.dhpublicnumber))
    {
        return new BCElGamalPublicKey(info);
    }
    else if (algOid.equals(OIWObjectIdentifiers.elGamalAlgorithm))
    {
        return new BCElGamalPublicKey(info);
    }
    else
    {
        throw new IOException("algorithm identifier " + algOid + " in key not recognised");
    }
}
项目:ipack    文件:EnvelopedDataHelper.java   
static Wrapper createRFC3211Wrapper(ASN1ObjectIdentifier algorithm)
    throws CMSException
{
    if (NISTObjectIdentifiers.id_aes128_CBC.equals(algorithm)
        || NISTObjectIdentifiers.id_aes192_CBC.equals(algorithm)
        || NISTObjectIdentifiers.id_aes256_CBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new AESEngine());
    }
    else if (PKCSObjectIdentifiers.des_EDE3_CBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new DESedeEngine());
    }
    else if (OIWObjectIdentifiers.desCBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new DESEngine());
    }
    else if (PKCSObjectIdentifiers.RC2_CBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new RC2Engine());
    }
    else
    {
        throw new CMSException("cannot recognise wrapper: " + algorithm);
    }
}
项目:gwt-crypto    文件:EnvelopedDataHelper.java   
static Wrapper createRFC3211Wrapper(ASN1ObjectIdentifier algorithm)
    throws CMSException
{
    if (NISTObjectIdentifiers.id_aes128_CBC.equals(algorithm)
        || NISTObjectIdentifiers.id_aes192_CBC.equals(algorithm)
        || NISTObjectIdentifiers.id_aes256_CBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new AESEngine());
    }
    else if (PKCSObjectIdentifiers.des_EDE3_CBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new DESedeEngine());
    }
    else if (OIWObjectIdentifiers.desCBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new DESEngine());
    }
    else if (PKCSObjectIdentifiers.RC2_CBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new RC2Engine());
    }
    else
    {
        throw new CMSException("cannot recognise wrapper: " + algorithm);
    }
}
项目:Aki-SSL    文件:SHA1.java   
public void configure(ConfigurableProvider provider)
{
    provider.addAlgorithm("MessageDigest.SHA-1", PREFIX + "$Digest");
    provider.addAlgorithm("Alg.Alias.MessageDigest.SHA1", "SHA-1");
    provider.addAlgorithm("Alg.Alias.MessageDigest.SHA", "SHA-1");
    provider.addAlgorithm("Alg.Alias.MessageDigest." + OIWObjectIdentifiers.idSHA1, "SHA-1");

    addHMACAlgorithm(provider, "SHA1", PREFIX + "$HashMac", PREFIX + "$KeyGenerator");
    addHMACAlias(provider, "SHA1", PKCSObjectIdentifiers.id_hmacWithSHA1);
    addHMACAlias(provider, "SHA1", IANAObjectIdentifiers.hmacSHA1);

    provider.addAlgorithm("Mac.PBEWITHHMACSHA", PREFIX + "$SHA1Mac");
    provider.addAlgorithm("Mac.PBEWITHHMACSHA1", PREFIX + "$SHA1Mac");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHHMACSHA", "PBEWITHHMACSHA1");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + OIWObjectIdentifiers.idSHA1, "PBEWITHHMACSHA1");
    provider.addAlgorithm("Alg.Alias.Mac." + OIWObjectIdentifiers.idSHA1, "PBEWITHHMACSHA");

    provider.addAlgorithm("SecretKeyFactory.PBEWITHHMACSHA1", PREFIX + "$PBEWithMacKeyFactory");
    provider.addAlgorithm("SecretKeyFactory.PBKDF2WithHmacSHA1", PREFIX + "$PBKDF2WithHmacSHA1UTF8");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBKDF2WithHmacSHA1AndUTF8", "PBKDF2WithHmacSHA1");
    provider.addAlgorithm("SecretKeyFactory.PBKDF2WithHmacSHA1And8BIT", PREFIX + "$PBKDF2WithHmacSHA18BIT");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBKDF2withASCII", "PBKDF2WithHmacSHA1And8BIT");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBKDF2with8BIT", "PBKDF2WithHmacSHA1And8BIT");
}
项目:Aki-SSL    文件:ElGamal.java   
public void configure(ConfigurableProvider provider)
{
    provider.addAlgorithm("AlgorithmParameterGenerator.ELGAMAL", PREFIX + "AlgorithmParameterGeneratorSpi");
    provider.addAlgorithm("AlgorithmParameterGenerator.ElGamal", PREFIX + "AlgorithmParameterGeneratorSpi");
    provider.addAlgorithm("AlgorithmParameters.ELGAMAL", PREFIX + "AlgorithmParametersSpi");
    provider.addAlgorithm("AlgorithmParameters.ElGamal", PREFIX + "AlgorithmParametersSpi");

    provider.addAlgorithm("Cipher.ELGAMAL", PREFIX + "CipherSpi$NoPadding");
    provider.addAlgorithm("Cipher.ElGamal", PREFIX + "CipherSpi$NoPadding");
    provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/ECB/PKCS1PADDING", "ELGAMAL/PKCS1");
    provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/NONE/PKCS1PADDING", "ELGAMAL/PKCS1");
    provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/NONE/NOPADDING", "ELGAMAL");

    provider.addAlgorithm("Cipher.ELGAMAL/PKCS1", PREFIX + "CipherSpi$PKCS1v1_5Padding");
    provider.addAlgorithm("KeyFactory.ELGAMAL", PREFIX + "KeyFactorySpi");
    provider.addAlgorithm("KeyFactory.ElGamal", PREFIX + "KeyFactorySpi");

    provider.addAlgorithm("KeyPairGenerator.ELGAMAL", PREFIX + "KeyPairGeneratorSpi");
    provider.addAlgorithm("KeyPairGenerator.ElGamal", PREFIX + "KeyPairGeneratorSpi");

    AsymmetricKeyInfoConverter keyFact = new KeyFactorySpi();

    registerOid(provider, OIWObjectIdentifiers.elGamalAlgorithm, "ELGAMAL", keyFact);
    registerOidAlgorithmParameters(provider, OIWObjectIdentifiers.elGamalAlgorithm, "ELGAMAL");
}
项目:Aki-SSL    文件:KeyFactorySpi.java   
public PrivateKey generatePrivate(PrivateKeyInfo info)
    throws IOException
{
    ASN1ObjectIdentifier algOid = info.getPrivateKeyAlgorithm().getAlgorithm();

    if (algOid.equals(PKCSObjectIdentifiers.dhKeyAgreement))
    {
        return new BCElGamalPrivateKey(info);
    }
    else if (algOid.equals(X9ObjectIdentifiers.dhpublicnumber))
    {
        return new BCElGamalPrivateKey(info);
    }
    else if (algOid.equals(OIWObjectIdentifiers.elGamalAlgorithm))
    {
        return new BCElGamalPrivateKey(info);
    }
    else
    {
        throw new IOException("algorithm identifier " + algOid + " in key not recognised");
    }
}
项目:Aki-SSL    文件:KeyFactorySpi.java   
public PublicKey generatePublic(SubjectPublicKeyInfo info)
    throws IOException
{
    ASN1ObjectIdentifier algOid = info.getAlgorithm().getAlgorithm();

    if (algOid.equals(PKCSObjectIdentifiers.dhKeyAgreement))
    {
        return new BCElGamalPublicKey(info);
    }
    else if (algOid.equals(X9ObjectIdentifiers.dhpublicnumber))
    {
        return new BCElGamalPublicKey(info);
    }
    else if (algOid.equals(OIWObjectIdentifiers.elGamalAlgorithm))
    {
        return new BCElGamalPublicKey(info);
    }
    else
    {
        throw new IOException("algorithm identifier " + algOid + " in key not recognised");
    }
}
项目:Aki-SSL    文件:EnvelopedDataHelper.java   
static Wrapper createRFC3211Wrapper(ASN1ObjectIdentifier algorithm)
    throws CMSException
{
    if (NISTObjectIdentifiers.id_aes128_CBC.equals(algorithm)
        || NISTObjectIdentifiers.id_aes192_CBC.equals(algorithm)
        || NISTObjectIdentifiers.id_aes256_CBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new AESEngine());
    }
    else if (PKCSObjectIdentifiers.des_EDE3_CBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new DESedeEngine());
    }
    else if (OIWObjectIdentifiers.desCBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new DESEngine());
    }
    else if (PKCSObjectIdentifiers.RC2_CBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new RC2Engine());
    }
    else
    {
        throw new CMSException("cannot recognise wrapper: " + algorithm);
    }
}
项目:jtrust    文件:PKITestUtils.java   
public static TimeStampToken createTimeStampToken(PrivateKey privateKey, List<X509Certificate> certificateChain)
        throws Exception {

    Store certs = new JcaCertStore(certificateChain);

    TimeStampRequestGenerator requestGen = new TimeStampRequestGenerator();
    requestGen.setCertReq(true);
    TimeStampRequest request = requestGen.generate(TSPAlgorithms.SHA1, new byte[20], BigInteger.valueOf(100));

    TimeStampTokenGenerator tsTokenGen = new TimeStampTokenGenerator(
            new JcaSimpleSignerInfoGeneratorBuilder().build("SHA1withRSA", privateKey, certificateChain.get(0)),
            new JcaDigestCalculatorProviderBuilder().build()
                    .get(new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1)),
            new ASN1ObjectIdentifier("1.2"));

    tsTokenGen.addCertificates(certs);
    return tsTokenGen.generate(request, BigInteger.ONE, new Date());
}
项目:CryptMeme    文件:SHA1.java   
public void configure(ConfigurableProvider provider)
{
    provider.addAlgorithm("MessageDigest.SHA-1", PREFIX + "$Digest");
    provider.addAlgorithm("Alg.Alias.MessageDigest.SHA1", "SHA-1");
    provider.addAlgorithm("Alg.Alias.MessageDigest.SHA", "SHA-1");
    provider.addAlgorithm("Alg.Alias.MessageDigest." + OIWObjectIdentifiers.idSHA1, "SHA-1");

    addHMACAlgorithm(provider, "SHA1", PREFIX + "$HashMac", PREFIX + "$KeyGenerator");
    addHMACAlias(provider, "SHA1", PKCSObjectIdentifiers.id_hmacWithSHA1);
    addHMACAlias(provider, "SHA1", IANAObjectIdentifiers.hmacSHA1);

    provider.addAlgorithm("Mac.PBEWITHHMACSHA", PREFIX + "$SHA1Mac");
    provider.addAlgorithm("Mac.PBEWITHHMACSHA1", PREFIX + "$SHA1Mac");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHHMACSHA", "PBEWITHHMACSHA1");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + OIWObjectIdentifiers.idSHA1, "PBEWITHHMACSHA1");
    provider.addAlgorithm("Alg.Alias.Mac." + OIWObjectIdentifiers.idSHA1, "PBEWITHHMACSHA");

    provider.addAlgorithm("SecretKeyFactory.PBEWITHHMACSHA1", PREFIX + "$PBEWithMacKeyFactory");
    provider.addAlgorithm("SecretKeyFactory.PBKDF2WithHmacSHA1", PREFIX + "$PBKDF2WithHmacSHA1UTF8");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBKDF2WithHmacSHA1AndUTF8", "PBKDF2WithHmacSHA1");
    provider.addAlgorithm("SecretKeyFactory.PBKDF2WithHmacSHA1And8BIT", PREFIX + "$PBKDF2WithHmacSHA18BIT");
}
项目:CryptMeme    文件:ElGamal.java   
public void configure(ConfigurableProvider provider)
{
    provider.addAlgorithm("AlgorithmParameterGenerator.ELGAMAL", PREFIX + "AlgorithmParameterGeneratorSpi");
    provider.addAlgorithm("AlgorithmParameterGenerator.ElGamal", PREFIX + "AlgorithmParameterGeneratorSpi");
    provider.addAlgorithm("AlgorithmParameters.ELGAMAL", PREFIX + "AlgorithmParametersSpi");
    provider.addAlgorithm("AlgorithmParameters.ElGamal", PREFIX + "AlgorithmParametersSpi");

    provider.addAlgorithm("Cipher.ELGAMAL", PREFIX + "CipherSpi$NoPadding");
    provider.addAlgorithm("Cipher.ElGamal", PREFIX + "CipherSpi$NoPadding");
    provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/ECB/PKCS1PADDING", "ELGAMAL/PKCS1");
    provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/NONE/PKCS1PADDING", "ELGAMAL/PKCS1");
    provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/NONE/NOPADDING", "ELGAMAL");

    provider.addAlgorithm("Cipher.ELGAMAL/PKCS1", PREFIX + "CipherSpi$PKCS1v1_5Padding");
    provider.addAlgorithm("KeyFactory.ELGAMAL", PREFIX + "KeyFactorySpi");
    provider.addAlgorithm("KeyFactory.ElGamal", PREFIX + "KeyFactorySpi");

    provider.addAlgorithm("KeyPairGenerator.ELGAMAL", PREFIX + "KeyPairGeneratorSpi");
    provider.addAlgorithm("KeyPairGenerator.ElGamal", PREFIX + "KeyPairGeneratorSpi");

    AsymmetricKeyInfoConverter keyFact = new KeyFactorySpi();

    registerOid(provider, OIWObjectIdentifiers.elGamalAlgorithm, "ELGAMAL", keyFact);
    registerOidAlgorithmParameters(provider, OIWObjectIdentifiers.elGamalAlgorithm, "ELGAMAL");
}
项目:CryptMeme    文件:KeyFactorySpi.java   
public PrivateKey generatePrivate(PrivateKeyInfo info)
    throws IOException
{
    ASN1ObjectIdentifier algOid = info.getPrivateKeyAlgorithm().getAlgorithm();

    if (algOid.equals(PKCSObjectIdentifiers.dhKeyAgreement))
    {
        return new BCElGamalPrivateKey(info);
    }
    else if (algOid.equals(X9ObjectIdentifiers.dhpublicnumber))
    {
        return new BCElGamalPrivateKey(info);
    }
    else if (algOid.equals(OIWObjectIdentifiers.elGamalAlgorithm))
    {
        return new BCElGamalPrivateKey(info);
    }
    else
    {
        throw new IOException("algorithm identifier " + algOid + " in key not recognised");
    }
}
项目:CryptMeme    文件:KeyFactorySpi.java   
public PublicKey generatePublic(SubjectPublicKeyInfo info)
    throws IOException
{
    ASN1ObjectIdentifier algOid = info.getAlgorithm().getAlgorithm();

    if (algOid.equals(PKCSObjectIdentifiers.dhKeyAgreement))
    {
        return new BCElGamalPublicKey(info);
    }
    else if (algOid.equals(X9ObjectIdentifiers.dhpublicnumber))
    {
        return new BCElGamalPublicKey(info);
    }
    else if (algOid.equals(OIWObjectIdentifiers.elGamalAlgorithm))
    {
        return new BCElGamalPublicKey(info);
    }
    else
    {
        throw new IOException("algorithm identifier " + algOid + " in key not recognised");
    }
}
项目:irma_future_id    文件:EnvelopedDataHelper.java   
static Wrapper createRFC3211Wrapper(ASN1ObjectIdentifier algorithm)
    throws CMSException
{
    if (NISTObjectIdentifiers.id_aes128_CBC.equals(algorithm)
        || NISTObjectIdentifiers.id_aes192_CBC.equals(algorithm)
        || NISTObjectIdentifiers.id_aes256_CBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new AESEngine());
    }
    else if (PKCSObjectIdentifiers.des_EDE3_CBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new DESedeEngine());
    }
    else if (OIWObjectIdentifiers.desCBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new DESEngine());
    }
    else if (PKCSObjectIdentifiers.RC2_CBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new RC2Engine());
    }
    else
    {
        throw new CMSException("cannot recognise wrapper: " + algorithm);
    }
}
项目:irma_future_id    文件:SHA1.java   
public void configure(ConfigurableProvider provider)
{
    provider.addAlgorithm("MessageDigest.SHA-1", PREFIX + "$Digest");
    provider.addAlgorithm("Alg.Alias.MessageDigest.SHA1", "SHA-1");
    provider.addAlgorithm("Alg.Alias.MessageDigest.SHA", "SHA-1");
    provider.addAlgorithm("Alg.Alias.MessageDigest." + OIWObjectIdentifiers.idSHA1, "SHA-1");

    addHMACAlgorithm(provider, "SHA1", PREFIX + "$HashMac", PREFIX + "$KeyGenerator");
    addHMACAlias(provider, "SHA1", PKCSObjectIdentifiers.id_hmacWithSHA1);
    addHMACAlias(provider, "SHA1", IANAObjectIdentifiers.hmacSHA1);

    provider.addAlgorithm("Mac.PBEWITHHMACSHA", PREFIX + "$SHA1Mac");
    provider.addAlgorithm("Mac.PBEWITHHMACSHA1", PREFIX + "$SHA1Mac");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHHMACSHA", "PBEWITHHMACSHA1");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + OIWObjectIdentifiers.idSHA1, "PBEWITHHMACSHA1");
    provider.addAlgorithm("Alg.Alias.Mac." + OIWObjectIdentifiers.idSHA1, "PBEWITHHMACSHA");

    provider.addAlgorithm("SecretKeyFactory.PBEWITHHMACSHA1", PREFIX + "$PBEWithMacKeyFactory");
    provider.addAlgorithm("SecretKeyFactory.PBKDF2WithHmacSHA1", PREFIX + "$PBKDF2WithHmacSHA1UTF8");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBKDF2WithHmacSHA1AndUTF8", "PBKDF2WithHmacSHA1");
    provider.addAlgorithm("SecretKeyFactory.PBKDF2WithHmacSHA1And8BIT", PREFIX + "$PBKDF2WithHmacSHA18BIT");
}
项目:irma_future_id    文件:ElGamal.java   
public void configure(ConfigurableProvider provider)
{
    provider.addAlgorithm("AlgorithmParameterGenerator.ELGAMAL", PREFIX + "AlgorithmParameterGeneratorSpi");
    provider.addAlgorithm("AlgorithmParameterGenerator.ElGamal", PREFIX + "AlgorithmParameterGeneratorSpi");
    provider.addAlgorithm("AlgorithmParameters.ELGAMAL", PREFIX + "AlgorithmParametersSpi");
    provider.addAlgorithm("AlgorithmParameters.ElGamal", PREFIX + "AlgorithmParametersSpi");

    provider.addAlgorithm("Cipher.ELGAMAL", PREFIX + "CipherSpi$NoPadding");
    provider.addAlgorithm("Cipher.ElGamal", PREFIX + "CipherSpi$NoPadding");
    provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/ECB/PKCS1PADDING", "ELGAMAL/PKCS1");
    provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/NONE/PKCS1PADDING", "ELGAMAL/PKCS1");
    provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/NONE/NOPADDING", "ELGAMAL");

    provider.addAlgorithm("Cipher.ELGAMAL/PKCS1", PREFIX + "CipherSpi$PKCS1v1_5Padding");
    provider.addAlgorithm("KeyFactory.ELGAMAL", PREFIX + "KeyFactorySpi");
    provider.addAlgorithm("KeyFactory.ElGamal", PREFIX + "KeyFactorySpi");

    provider.addAlgorithm("KeyPairGenerator.ELGAMAL", PREFIX + "KeyPairGeneratorSpi");
    provider.addAlgorithm("KeyPairGenerator.ElGamal", PREFIX + "KeyPairGeneratorSpi");

    AsymmetricKeyInfoConverter keyFact = new KeyFactorySpi();

    registerOid(provider, OIWObjectIdentifiers.elGamalAlgorithm, "ELGAMAL", keyFact);
    registerOidAlgorithmParameters(provider, OIWObjectIdentifiers.elGamalAlgorithm, "ELGAMAL");
}
项目:irma_future_id    文件:KeyFactorySpi.java   
public PrivateKey generatePrivate(PrivateKeyInfo info)
    throws IOException
{
    ASN1ObjectIdentifier algOid = info.getPrivateKeyAlgorithm().getAlgorithm();

    if (algOid.equals(PKCSObjectIdentifiers.dhKeyAgreement))
    {
        return new BCElGamalPrivateKey(info);
    }
    else if (algOid.equals(X9ObjectIdentifiers.dhpublicnumber))
    {
        return new BCElGamalPrivateKey(info);
    }
    else if (algOid.equals(OIWObjectIdentifiers.elGamalAlgorithm))
    {
        return new BCElGamalPrivateKey(info);
    }
    else
    {
        throw new IOException("algorithm identifier " + algOid + " in key not recognised");
    }
}
项目:irma_future_id    文件:KeyFactorySpi.java   
public PublicKey generatePublic(SubjectPublicKeyInfo info)
    throws IOException
{
    ASN1ObjectIdentifier algOid = info.getAlgorithm().getAlgorithm();

    if (algOid.equals(PKCSObjectIdentifiers.dhKeyAgreement))
    {
        return new BCElGamalPublicKey(info);
    }
    else if (algOid.equals(X9ObjectIdentifiers.dhpublicnumber))
    {
        return new BCElGamalPublicKey(info);
    }
    else if (algOid.equals(OIWObjectIdentifiers.elGamalAlgorithm))
    {
        return new BCElGamalPublicKey(info);
    }
    else
    {
        throw new IOException("algorithm identifier " + algOid + " in key not recognised");
    }
}
项目:bc-java    文件:EnvelopedDataHelper.java   
static Wrapper createRFC3211Wrapper(ASN1ObjectIdentifier algorithm)
    throws CMSException
{
    if (NISTObjectIdentifiers.id_aes128_CBC.equals(algorithm)
        || NISTObjectIdentifiers.id_aes192_CBC.equals(algorithm)
        || NISTObjectIdentifiers.id_aes256_CBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new AESEngine());
    }
    else if (PKCSObjectIdentifiers.des_EDE3_CBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new DESedeEngine());
    }
    else if (OIWObjectIdentifiers.desCBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new DESEngine());
    }
    else if (PKCSObjectIdentifiers.RC2_CBC.equals(algorithm))
    {
        return new RFC3211WrapEngine(new RC2Engine());
    }
    else
    {
        throw new CMSException("cannot recognise wrapper: " + algorithm);
    }
}
项目:bc-java    文件:SHA1.java   
public void configure(ConfigurableProvider provider)
{
    provider.addAlgorithm("MessageDigest.SHA-1", PREFIX + "$Digest");
    provider.addAlgorithm("Alg.Alias.MessageDigest.SHA1", "SHA-1");
    provider.addAlgorithm("Alg.Alias.MessageDigest.SHA", "SHA-1");
    provider.addAlgorithm("Alg.Alias.MessageDigest." + OIWObjectIdentifiers.idSHA1, "SHA-1");

    addHMACAlgorithm(provider, "SHA1", PREFIX + "$HashMac", PREFIX + "$KeyGenerator");
    addHMACAlias(provider, "SHA1", PKCSObjectIdentifiers.id_hmacWithSHA1);
    addHMACAlias(provider, "SHA1", IANAObjectIdentifiers.hmacSHA1);

    provider.addAlgorithm("Mac.PBEWITHHMACSHA", PREFIX + "$SHA1Mac");
    provider.addAlgorithm("Mac.PBEWITHHMACSHA1", PREFIX + "$SHA1Mac");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHHMACSHA", "PBEWITHHMACSHA1");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + OIWObjectIdentifiers.idSHA1, "PBEWITHHMACSHA1");
    provider.addAlgorithm("Alg.Alias.Mac." + OIWObjectIdentifiers.idSHA1, "PBEWITHHMACSHA");

    provider.addAlgorithm("SecretKeyFactory.PBEWITHHMACSHA1", PREFIX + "$PBEWithMacKeyFactory");
    provider.addAlgorithm("SecretKeyFactory.PBKDF2WithHmacSHA1", PREFIX + "$PBKDF2WithHmacSHA1UTF8");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBKDF2WithHmacSHA1AndUTF8", "PBKDF2WithHmacSHA1");
    provider.addAlgorithm("SecretKeyFactory.PBKDF2WithHmacSHA1And8BIT", PREFIX + "$PBKDF2WithHmacSHA18BIT");
}
项目:bc-java    文件:ElGamal.java   
public void configure(ConfigurableProvider provider)
{
    provider.addAlgorithm("AlgorithmParameterGenerator.ELGAMAL", PREFIX + "AlgorithmParameterGeneratorSpi");
    provider.addAlgorithm("AlgorithmParameterGenerator.ElGamal", PREFIX + "AlgorithmParameterGeneratorSpi");
    provider.addAlgorithm("AlgorithmParameters.ELGAMAL", PREFIX + "AlgorithmParametersSpi");
    provider.addAlgorithm("AlgorithmParameters.ElGamal", PREFIX + "AlgorithmParametersSpi");

    provider.addAlgorithm("Cipher.ELGAMAL", PREFIX + "CipherSpi$NoPadding");
    provider.addAlgorithm("Cipher.ElGamal", PREFIX + "CipherSpi$NoPadding");
    provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/ECB/PKCS1PADDING", "ELGAMAL/PKCS1");
    provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/NONE/PKCS1PADDING", "ELGAMAL/PKCS1");
    provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/NONE/NOPADDING", "ELGAMAL");

    provider.addAlgorithm("Cipher.ELGAMAL/PKCS1", PREFIX + "CipherSpi$PKCS1v1_5Padding");
    provider.addAlgorithm("KeyFactory.ELGAMAL", PREFIX + "KeyFactorySpi");
    provider.addAlgorithm("KeyFactory.ElGamal", PREFIX + "KeyFactorySpi");

    provider.addAlgorithm("KeyPairGenerator.ELGAMAL", PREFIX + "KeyPairGeneratorSpi");
    provider.addAlgorithm("KeyPairGenerator.ElGamal", PREFIX + "KeyPairGeneratorSpi");

    AsymmetricKeyInfoConverter keyFact = new KeyFactorySpi();

    registerOid(provider, OIWObjectIdentifiers.elGamalAlgorithm, "ELGAMAL", keyFact);
    registerOidAlgorithmParameters(provider, OIWObjectIdentifiers.elGamalAlgorithm, "ELGAMAL");
}
项目:bc-java    文件:KeyFactorySpi.java   
public PrivateKey generatePrivate(PrivateKeyInfo info)
    throws IOException
{
    ASN1ObjectIdentifier algOid = info.getPrivateKeyAlgorithm().getAlgorithm();

    if (algOid.equals(PKCSObjectIdentifiers.dhKeyAgreement))
    {
        return new BCElGamalPrivateKey(info);
    }
    else if (algOid.equals(X9ObjectIdentifiers.dhpublicnumber))
    {
        return new BCElGamalPrivateKey(info);
    }
    else if (algOid.equals(OIWObjectIdentifiers.elGamalAlgorithm))
    {
        return new BCElGamalPrivateKey(info);
    }
    else
    {
        throw new IOException("algorithm identifier " + algOid + " in key not recognised");
    }
}
项目:bc-java    文件:KeyFactorySpi.java   
public PublicKey generatePublic(SubjectPublicKeyInfo info)
    throws IOException
{
    ASN1ObjectIdentifier algOid = info.getAlgorithm().getAlgorithm();

    if (algOid.equals(PKCSObjectIdentifiers.dhKeyAgreement))
    {
        return new BCElGamalPublicKey(info);
    }
    else if (algOid.equals(X9ObjectIdentifiers.dhpublicnumber))
    {
        return new BCElGamalPublicKey(info);
    }
    else if (algOid.equals(OIWObjectIdentifiers.elGamalAlgorithm))
    {
        return new BCElGamalPublicKey(info);
    }
    else
    {
        throw new IOException("algorithm identifier " + algOid + " in key not recognised");
    }
}
项目:ipack    文件:OtherHash.java   
public AlgorithmIdentifier getHashAlgorithm()
{
    if (null == this.otherHash)
    {
        return new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1);
    }
    return this.otherHash.getHashAlgorithm();
}
项目:ipack    文件:BCElGamalPrivateKey.java   
/**
 * Return a PKCS8 representation of the key. The sequence returned
 * represents a full PrivateKeyInfo object.
 *
 * @return a PKCS8 representation of the key.
 */
public byte[] getEncoded()
{
    try
    {
        PrivateKeyInfo          info = new PrivateKeyInfo(new AlgorithmIdentifier(OIWObjectIdentifiers.elGamalAlgorithm, new ElGamalParameter(elSpec.getP(), elSpec.getG())), new DERInteger(getX()));

        return info.getEncoded(ASN1Encoding.DER);
    }
    catch (IOException e)
    {
        return null;
    }
}
项目:ipack    文件:BCElGamalPublicKey.java   
public byte[] getEncoded()
{
    try
    {
        SubjectPublicKeyInfo    info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(OIWObjectIdentifiers.elGamalAlgorithm, new ElGamalParameter(elSpec.getP(), elSpec.getG())), new DERInteger(y));

        return info.getEncoded(ASN1Encoding.DER);
    }
    catch (IOException e)
    {
        return null;
    }
}
项目:ipack    文件:TimeStampTokenGenerator.java   
/**
 * basic creation - only the default attributes will be included here.
 * @deprecated use SignerInfoGenerator constructor that takes a digest calculator
 */
public TimeStampTokenGenerator(
    final SignerInfoGenerator     signerInfoGen,
    ASN1ObjectIdentifier          tsaPolicy)
    throws IllegalArgumentException, TSPException
{
    this(new DigestCalculator()
    {
        private ByteArrayOutputStream bOut = new ByteArrayOutputStream();

        public AlgorithmIdentifier getAlgorithmIdentifier()
        {
            return new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1, DERNull.INSTANCE);
        }

        public OutputStream getOutputStream()
        {
            return bOut;
        }

        public byte[] getDigest()
        {
            try
            {
                return MessageDigest.getInstance("SHA-1").digest(bOut.toByteArray());
            }
            catch (NoSuchAlgorithmException e)
            {
                throw new IllegalStateException("cannot find sha-1: "+ e.getMessage());
            }
        }
    }, signerInfoGen, tsaPolicy);
}
项目:ipack    文件:TimeStampToken.java   
public AlgorithmIdentifier getHashAlgorithm()
{
    if (certID != null)
    {
        return new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1);
    }
    else
    {
        return certIDv2.getHashAlgorithm();
    }
}
项目:gwt-crypto    文件:OtherHash.java   
public AlgorithmIdentifier getHashAlgorithm()
{
    if (null == this.otherHash)
    {
        return new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1);
    }
    return this.otherHash.getHashAlgorithm();
}
项目:gwt-crypto    文件:OtherCertID.java   
public AlgorithmIdentifier getAlgorithmHash()
{
    if (otherCertHash.toASN1Primitive() instanceof ASN1OctetString)
    {
        // SHA-1
        return new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1);
    }
    else
    {
        return DigestInfo.getInstance(otherCertHash).getAlgorithmId();
    }
}
项目:gwt-crypto    文件:TimeStampToken.java   
public AlgorithmIdentifier getHashAlgorithm()
{
    if (certID != null)
    {
        return new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1);
    }
    else
    {
        return certIDv2.getHashAlgorithm();
    }
}
项目:cert-services    文件:CertificateService.java   
private void addKeyIdentifiers(SubjectPublicKeyInfo subjectPubKeyInfo, SubjectPublicKeyInfo issuerPubKeyInfo, X509v3CertificateBuilder v3CertGen) throws OperatorCreationException, CertIOException {
    DigestCalculator digCalc = new BcDigestCalculatorProvider().get(new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1));
    X509ExtensionUtils x509ExtensionUtils = new X509ExtensionUtils(digCalc);

    v3CertGen.addExtension(Extension.subjectKeyIdentifier, false, x509ExtensionUtils.createSubjectKeyIdentifier(subjectPubKeyInfo));
    v3CertGen.addExtension(Extension.authorityKeyIdentifier, false, x509ExtensionUtils.createAuthorityKeyIdentifier(issuerPubKeyInfo));
}
项目:Aki-SSL    文件:OtherHash.java   
public AlgorithmIdentifier getHashAlgorithm()
{
    if (null == this.otherHash)
    {
        return new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1);
    }
    return this.otherHash.getHashAlgorithm();
}
项目:Aki-SSL    文件:OtherCertID.java   
public AlgorithmIdentifier getAlgorithmHash()
{
    if (otherCertHash.toASN1Primitive() instanceof ASN1OctetString)
    {
        // SHA-1
        return new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1);
    }
    else
    {
        return DigestInfo.getInstance(otherCertHash).getAlgorithmId();
    }
}
项目:Aki-SSL    文件:BCElGamalPrivateKey.java   
/**
 * Return a PKCS8 representation of the key. The sequence returned
 * represents a full PrivateKeyInfo object.
 *
 * @return a PKCS8 representation of the key.
 */
public byte[] getEncoded()
{
    try
    {
        PrivateKeyInfo          info = new PrivateKeyInfo(new AlgorithmIdentifier(OIWObjectIdentifiers.elGamalAlgorithm, new ElGamalParameter(elSpec.getP(), elSpec.getG())), new ASN1Integer(getX()));

        return info.getEncoded(ASN1Encoding.DER);
    }
    catch (IOException e)
    {
        return null;
    }
}
项目:Aki-SSL    文件:BCElGamalPublicKey.java   
public byte[] getEncoded()
{
    try
    {
        SubjectPublicKeyInfo    info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(OIWObjectIdentifiers.elGamalAlgorithm, new ElGamalParameter(elSpec.getP(), elSpec.getG())), new ASN1Integer(y));

        return info.getEncoded(ASN1Encoding.DER);
    }
    catch (IOException e)
    {
        return null;
    }
}
项目:Aki-SSL    文件:JceCMSContentEncryptorBuilder.java   
public JceCMSContentEncryptorBuilder(ASN1ObjectIdentifier encryptionOID, int keySize)
{
    this.encryptionOID = encryptionOID;

    int fixedSize = KEY_SIZE_PROVIDER.getKeySize(encryptionOID);

    if (encryptionOID.equals(PKCSObjectIdentifiers.des_EDE3_CBC))
    {
        if (keySize != 168 && keySize != fixedSize)
        {
            throw new IllegalArgumentException("incorrect keySize for encryptionOID passed to builder.");
        }
        this.keySize = 168;
    }
    else if (encryptionOID.equals(OIWObjectIdentifiers.desCBC))
    {
        if (keySize != 56 && keySize != fixedSize)
        {
            throw new IllegalArgumentException("incorrect keySize for encryptionOID passed to builder.");
        }
        this.keySize = 56;
    }
    else
    {
        if (fixedSize > 0 && fixedSize != keySize)
        {
            throw new IllegalArgumentException("incorrect keySize for encryptionOID passed to builder.");
        }
        this.keySize = keySize;
    }
}