OpenSSLProvider.java revision 746a236e2be5dee62c482e27f4c682496d071d8b
1/* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package org.apache.harmony.xnet.provider.jsse; 18 19import java.security.Provider; 20 21public final class OpenSSLProvider extends Provider { 22 public static final String PROVIDER_NAME = "AndroidOpenSSL"; 23 24 public OpenSSLProvider() { 25 super(PROVIDER_NAME, 1.0, "Android's OpenSSL-backed security provider"); 26 27 // SSL Contexts 28 put("SSLContext.SSL", OpenSSLContextImpl.class.getName()); 29 put("SSLContext.SSLv3", OpenSSLContextImpl.class.getName()); 30 put("SSLContext.TLS", OpenSSLContextImpl.class.getName()); 31 put("SSLContext.TLSv1", OpenSSLContextImpl.class.getName()); 32 put("SSLContext.Default", DefaultSSLContextImpl.class.getName()); 33 34 // Message Digests 35 put("MessageDigest.SHA-1", 36 "org.apache.harmony.xnet.provider.jsse.OpenSSLMessageDigestJDK$SHA1"); 37 put("Alg.Alias.MessageDigest.SHA1", "SHA-1"); 38 put("Alg.Alias.MessageDigest.SHA", "SHA-1"); 39 put("Alg.Alias.MessageDigest.1.3.14.3.2.26", "SHA-1"); 40 41 put("MessageDigest.SHA-256", 42 "org.apache.harmony.xnet.provider.jsse.OpenSSLMessageDigestJDK$SHA256"); 43 put("Alg.Alias.MessageDigest.SHA256", "SHA-256"); 44 put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.1", "SHA-256"); 45 46 put("MessageDigest.SHA-384", 47 "org.apache.harmony.xnet.provider.jsse.OpenSSLMessageDigestJDK$SHA384"); 48 put("Alg.Alias.MessageDigest.SHA384", "SHA-384"); 49 put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.2", "SHA-384"); 50 51 put("MessageDigest.SHA-512", 52 "org.apache.harmony.xnet.provider.jsse.OpenSSLMessageDigestJDK$SHA512"); 53 put("Alg.Alias.MessageDigest.SHA512", "SHA-512"); 54 put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.3", "SHA-512"); 55 56 put("MessageDigest.MD5", 57 "org.apache.harmony.xnet.provider.jsse.OpenSSLMessageDigestJDK$MD5"); 58 put("Alg.Alias.MessageDigest.1.2.840.113549.2.5", "MD5"); 59 60 // KeyPairGenerators 61 put("KeyPairGenerator.RSA", OpenSSLRSAKeyPairGenerator.class.getName()); 62 put("Alg.Alias.KeyPairGenerator.1.2.840.113549.1.1.1", "RSA"); 63 64 put("KeyPairGenerator.DSA", OpenSSLDSAKeyPairGenerator.class.getName()); 65 66 // KeyFactory 67 68 put("KeyFactory.RSA", OpenSSLRSAKeyFactory.class.getName()); 69 put("Alg.Alias.KeyFactory.1.2.840.113549.1.1.1", "RSA"); 70 71 // put("KeyFactory.DSA", OpenSSLDSAKeyFactory.class.getName()); 72 73 // Signatures 74 put("Signature.MD5WithRSAEncryption", OpenSSLSignature.MD5RSA.class.getName()); 75 put("Alg.Alias.Signature.MD5WithRSA", "MD5WithRSAEncryption"); 76 put("Alg.Alias.Signature.MD5/RSA", "MD5WithRSAEncryption"); 77 put("Alg.Alias.Signature.1.2.840.113549.1.1.4", "MD5WithRSAEncryption"); 78 put("Alg.Alias.Signature.1.2.840.113549.2.5with1.2.840.113549.1.1.1", 79 "MD5WithRSAEncryption"); 80 81 put("Signature.SHA1WithRSAEncryption", OpenSSLSignature.SHA1RSA.class.getName()); 82 put("Alg.Alias.Signature.SHA1WithRSA", "SHA1WithRSAEncryption"); 83 put("Alg.Alias.Signature.SHA1/RSA", "SHA1WithRSAEncryption"); 84 put("Alg.Alias.Signature.SHA-1/RSA", "SHA1WithRSAEncryption"); 85 put("Alg.Alias.Signature.1.2.840.113549.1.1.5", "SHA1WithRSAEncryption"); 86 put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.113549.1.1.1", "SHA1WithRSAEncryption"); 87 put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.113549.1.1.5", "SHA1WithRSAEncryption"); 88 put("Alg.Alias.Signature.1.3.14.3.2.29", "SHA1WithRSAEncryption"); 89 90 put("Signature.SHA256WithRSAEncryption", OpenSSLSignature.SHA256RSA.class.getName()); 91 put("Alg.Alias.Signature.SHA256WithRSA", "SHA256WithRSAEncryption"); 92 put("Alg.Alias.Signature.1.2.840.113549.1.1.11", "SHA256WithRSAEncryption"); 93 94 put("Signature.SHA384WithRSAEncryption", OpenSSLSignature.SHA384RSA.class.getName()); 95 put("Alg.Alias.Signature.SHA384WithRSA", "SHA384WithRSAEncryption"); 96 put("Alg.Alias.Signature.1.2.840.113549.1.1.12", "SHA384WithRSAEncryption"); 97 98 put("Signature.SHA512WithRSAEncryption", OpenSSLSignature.SHA512RSA.class.getName()); 99 put("Alg.Alias.Signature.SHA512WithRSA", "SHA512WithRSAEncryption"); 100 put("Alg.Alias.Signature.1.2.840.113549.1.1.13", "SHA512WithRSAEncryption"); 101 102 put("Signature.SHA1withDSA", OpenSSLSignature.SHA1DSA.class.getName()); 103 put("Alg.Alias.Signature.SHA/DSA", "SHA1withDSA"); 104 put("Alg.Alias.Signature.DSA", "SHA1withDSA"); 105 put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.1", "SHA1withDSA"); 106 put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.3", "SHA1withDSA"); 107 put("Alg.Alias.Signature.DSAWithSHA1", "SHA1withDSA"); 108 put("Alg.Alias.Signature.1.2.840.10040.4.3", "SHA1withDSA"); 109 } 110} 111