Java 类org.bouncycastle.asn1.misc.MiscObjectIdentifiers 实例源码

项目:Aki-SSL    文件:IDEA.java   
public void configure(ConfigurableProvider provider)
{
    provider.addAlgorithm("AlgorithmParameterGenerator.IDEA", PREFIX + "$AlgParamGen");
    provider.addAlgorithm("AlgorithmParameterGenerator.1.3.6.1.4.1.188.7.1.1.2", PREFIX + "$AlgParamGen");
    provider.addAlgorithm("AlgorithmParameters.IDEA", PREFIX + "$AlgParams");
    provider.addAlgorithm("AlgorithmParameters.1.3.6.1.4.1.188.7.1.1.2", PREFIX + "$AlgParams");
    provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDIDEA", "PKCS12PBE");
    provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDIDEA-CBC", "PKCS12PBE");
    provider.addAlgorithm("Cipher.IDEA", PREFIX + "$ECB");
    provider.addAlgorithm("Cipher", MiscObjectIdentifiers.as_sys_sec_alg_ideaCBC, PREFIX + "$CBC");
    provider.addAlgorithm("Cipher.PBEWITHSHAANDIDEA-CBC", PREFIX + "$PBEWithSHAAndIDEA");
    provider.addAlgorithm("KeyGenerator.IDEA", PREFIX + "$KeyGen");
    provider.addAlgorithm("KeyGenerator",  MiscObjectIdentifiers.as_sys_sec_alg_ideaCBC, PREFIX + "$KeyGen");
    provider.addAlgorithm("SecretKeyFactory.PBEWITHSHAANDIDEA-CBC", PREFIX + "$PBEWithSHAAndIDEAKeyGen");
    provider.addAlgorithm("Mac.IDEAMAC", PREFIX + "$Mac");
    provider.addAlgorithm("Alg.Alias.Mac.IDEA", "IDEAMAC");
    provider.addAlgorithm("Mac.IDEAMAC/CFB8", PREFIX + "$CFB8Mac");
    provider.addAlgorithm("Alg.Alias.Mac.IDEA/CFB8", "IDEAMAC/CFB8");
}
项目:Mailster    文件:MailsterKeyStoreFactory.java   
private void generateDummySSLClientCertificate(KeyStore ks)
    throws Exception
{
    LOG.info("Generating a Dummy SSL client certificate ...");
    KeyPair pair = CertificateUtilities.generateRSAKeyPair(getCryptoStrength());
    String DN = "CN=SSL dummy client cert, O=Dummy org., C=FR";
    X509V3CertificateGenerator v3CertGen = CertificateUtilities.initCertificateGenerator(pair, DN, DN, true,
            CertificateUtilities.DEFAULT_VALIDITY_PERIOD);

    v3CertGen.addExtension(X509Extensions.BasicConstraints, true, new BasicConstraints(false));

    v3CertGen.addExtension(MiscObjectIdentifiers.netscapeCertType, false, new NetscapeCertType(NetscapeCertType.sslClient));

    v3CertGen.addExtension(X509Extensions.ExtendedKeyUsage, false, new ExtendedKeyUsage(KeyPurposeId.id_kp_clientAuth));

    X509Certificate cert = v3CertGen.generate(pair.getPrivate());
    ks.setKeyEntry(DUMMY_SSL_CLIENT_ALIAS, pair.getPrivate(), KEYSTORE_PASSWORD, new Certificate[] {cert});
}
项目:Aki-SSL    文件:Blowfish.java   
public void configure(ConfigurableProvider provider)
{

    provider.addAlgorithm("Mac.BLOWFISHCMAC", PREFIX + "$CMAC");
    provider.addAlgorithm("Cipher.BLOWFISH", PREFIX + "$ECB");
    provider.addAlgorithm("Cipher", MiscObjectIdentifiers.cryptlib_algorithm_blowfish_CBC, PREFIX + "$CBC");
    provider.addAlgorithm("KeyGenerator.BLOWFISH", PREFIX + "$KeyGen");
    provider.addAlgorithm("Alg.Alias.KeyGenerator", MiscObjectIdentifiers.cryptlib_algorithm_blowfish_CBC, "BLOWFISH");
    provider.addAlgorithm("AlgorithmParameters.BLOWFISH", PREFIX + "$AlgParams");
    provider.addAlgorithm("Alg.Alias.AlgorithmParameters", MiscObjectIdentifiers.cryptlib_algorithm_blowfish_CBC, "BLOWFISH");

}
项目:Aki-SSL    文件:Blake2b.java   
public void configure(ConfigurableProvider provider)
{
    provider.addAlgorithm("MessageDigest.BLAKE2B-512", PREFIX + "$Blake2b512");
    provider.addAlgorithm("Alg.Alias.MessageDigest." + MiscObjectIdentifiers.id_blake2b512, "BLAKE2B-512");

    provider.addAlgorithm("MessageDigest.BLAKE2B-384", PREFIX + "$Blake2b384");
    provider.addAlgorithm("Alg.Alias.MessageDigest." + MiscObjectIdentifiers.id_blake2b384, "BLAKE2B-384");

    provider.addAlgorithm("MessageDigest.BLAKE2B-256", PREFIX + "$Blake2b256");
    provider.addAlgorithm("Alg.Alias.MessageDigest." + MiscObjectIdentifiers.id_blake2b256, "BLAKE2B-256");

    provider.addAlgorithm("MessageDigest.BLAKE2B-160", PREFIX + "$Blake2b160");
    provider.addAlgorithm("Alg.Alias.MessageDigest." + MiscObjectIdentifiers.id_blake2b160, "BLAKE2B-160");
}
项目:Mailster    文件:MailsterKeyStoreFactory.java   
private void generateSSLServerCertificate(KeyStore store, X500PrivateCredential rootCredential)
    throws Exception
{
    LOG.info("Generating SSL server certificate ...");
    KeyPair pair = CertificateUtilities.generateRSAKeyPair(getCryptoStrength());
    String DN = "CN=localhost, " + DN_ROOT;
    X509V3CertificateGenerator v3CertGen = CertificateUtilities.initCertificateGenerator(pair, rootCredential
            .getCertificate().getSubjectX500Principal().getName(), DN, false, CertificateUtilities.DEFAULT_VALIDITY_PERIOD);

    v3CertGen.addExtension(X509Extensions.BasicConstraints, true, new BasicConstraints(false));

    v3CertGen.addExtension(MiscObjectIdentifiers.netscapeCertType, false, new NetscapeCertType(NetscapeCertType.sslServer
            | NetscapeCertType.sslClient));

    // Firefox 2 disallows these extensions in an SSL server cert. IE7 doesn't care.
    // v3CertGen.addExtension(X509Extensions.KeyUsage,
    // true, new KeyUsage(KeyUsage.dataEncipherment | KeyUsage.keyAgreement |
    // KeyUsage.keyEncipherment));

    Vector<KeyPurposeId> typicalSSLServerExtendedKeyUsages = new Vector<KeyPurposeId>();

    typicalSSLServerExtendedKeyUsages.add(KeyPurposeId.id_kp_serverAuth);
    typicalSSLServerExtendedKeyUsages.add(KeyPurposeId.id_kp_clientAuth);

    v3CertGen.addExtension(X509Extensions.ExtendedKeyUsage, false, new ExtendedKeyUsage(typicalSSLServerExtendedKeyUsages));

    X509Certificate publicKeyCertificate = v3CertGen.generate(pair.getPrivate());
    store.setKeyEntry(MAILSTER_SSL_ALIAS, pair.getPrivate(), KEYSTORE_PASSWORD, new Certificate[] {publicKeyCertificate,
            rootCredential.getCertificate()});
    CertificateUtilities.exportCertificate(publicKeyCertificate, SSL_CERT_FULL_PATH, false);
}
项目:Mailster    文件:CertificateUtilities.java   
/**
 * Generate a CA Root certificate.
 */
private static X509Certificate generateRootCert(String DN, KeyPair pair)
    throws Exception
{
    X509V3CertificateGenerator certGen = new X509V3CertificateGenerator();
    certGen.setIssuerDN(new X509Name(true, X509Name.DefaultLookUp, DN));
    certGen.setSubjectDN(new X509Name(true, X509Name.DefaultLookUp, DN));   

    setSerialNumberAndValidityPeriod(certGen, true, DEFAULT_VALIDITY_PERIOD);  

    certGen.setPublicKey(pair.getPublic());
    certGen.setSignatureAlgorithm("SHA1WithRSAEncryption");

    certGen.addExtension(X509Extensions.AuthorityKeyIdentifier, 
            false, new AuthorityKeyIdentifier(
                    new GeneralNames(new GeneralName(new X509Name(true, X509Name.DefaultLookUp, DN))), 
                    BigInteger.ONE));
    certGen.addExtension(X509Extensions.SubjectKeyIdentifier, 
            false, new SubjectKeyIdentifierStructure(pair.getPublic()));

    certGen.addExtension(X509Extensions.BasicConstraints, 
            true, new BasicConstraints(true));
    certGen.addExtension(X509Extensions.KeyUsage, 
            true, new KeyUsage(KeyUsage.keyCertSign | KeyUsage.cRLSign | KeyUsage.nonRepudiation));
    certGen.addExtension(MiscObjectIdentifiers.netscapeCertType, 
            false, new NetscapeCertType(NetscapeCertType.smimeCA | 
                    NetscapeCertType.sslCA | NetscapeCertType.objectSigning));

    return certGen.generate(pair.getPrivate(), "BC");
}
项目:Aki-SSL    文件:CAST5.java   
public void configure(ConfigurableProvider provider)
{

    provider.addAlgorithm("AlgorithmParameters.CAST5", PREFIX + "$AlgParams");
    provider.addAlgorithm("Alg.Alias.AlgorithmParameters.1.2.840.113533.7.66.10", "CAST5");

    provider.addAlgorithm("AlgorithmParameterGenerator.CAST5", PREFIX + "$AlgParamGen");
    provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator.1.2.840.113533.7.66.10", "CAST5");

    provider.addAlgorithm("Cipher.CAST5", PREFIX + "$ECB");
    provider.addAlgorithm("Cipher", MiscObjectIdentifiers.cast5CBC, PREFIX + "$CBC");

    provider.addAlgorithm("KeyGenerator.CAST5", PREFIX + "$KeyGen");
    provider.addAlgorithm("Alg.Alias.KeyGenerator", MiscObjectIdentifiers.cast5CBC, "CAST5");

}