blob: 7c2785afa5bfd9ff3c133df3294eb3e24bdfe5e2 [file] [log] [blame]
The Android Open Source Projectadc854b2009-03-03 19:28:47 -08001/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18package org.apache.harmony.security.provider.crypto;
19
Jesse Wilson7365de12010-08-11 15:21:19 -070020import java.security.Provider;
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080021
22/**
23 * Implementation of Provider for SecureRandom, MessageDigest and Signature
24 * using a Secure Hash Algorithm, SHA-1;
25 * see SECURE HASH STANDARD, FIPS PUB 180-1 (http://www.itl.nist.gov/fipspubs/fip180-1.htm) <BR>
26 * <BR>
27 * The implementation supports "SHA1PRNG", "SHA-1" and "SHA1withDSA" algorithms described in
28 * JavaTM Cryptography Architecture, API Specification & Reference
29 */
30
31public final class CryptoProvider extends Provider {
32
33 private static final long serialVersionUID = 7991202868423459598L;
34
35 /**
36 * Creates a Provider and puts parameters
37 */
38 public CryptoProvider() {
39
Elliott Hughesad416242011-01-06 18:13:31 -080040 super("Crypto", 1.0, "HARMONY (SHA1 digest; SecureRandom; SHA1withDSA signature)");
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080041
42 // names of classes implementing services
Elliott Hughesf33eae72010-05-13 12:36:25 -070043 final String MD_NAME = "org.apache.harmony.security.provider.crypto.SHA1_MessageDigestImpl";
44 final String SR_NAME = "org.apache.harmony.security.provider.crypto.SHA1PRNG_SecureRandomImpl";
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080045
Elliott Hughesf33eae72010-05-13 12:36:25 -070046 final String SIGN_NAME = "org.apache.harmony.security.provider.crypto.SHA1withDSA_SignatureImpl";
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080047
Elliott Hughesf33eae72010-05-13 12:36:25 -070048 final String SIGN_ALIAS = "SHA1withDSA";
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080049
50
Elliott Hughesad416242011-01-06 18:13:31 -080051 final String KEYF_NAME = "org.apache.harmony.security.provider.crypto.DSAKeyFactoryImpl";
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080052
Elliott Hughesad416242011-01-06 18:13:31 -080053 put("MessageDigest.SHA-1", MD_NAME);
54 put("MessageDigest.SHA-1 ImplementedIn", "Software");
55 put("Alg.Alias.MessageDigest.SHA1", "SHA-1");
56 put("Alg.Alias.MessageDigest.SHA", "SHA-1");
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080057
Elliott Hughesb2da4ac2013-04-24 14:58:26 -070058 put("SecureRandom.SHA1PRNG", SR_NAME);
59 put("SecureRandom.SHA1PRNG ImplementedIn", "Software");
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080060
Elliott Hughesad416242011-01-06 18:13:31 -080061 put("Signature.SHA1withDSA", SIGN_NAME);
62 put("Signature.SHA1withDSA ImplementedIn", "Software");
63 put("Alg.Alias.Signature.SHAwithDSA", SIGN_ALIAS);
64 put("Alg.Alias.Signature.DSAwithSHA1", SIGN_ALIAS);
65 put("Alg.Alias.Signature.SHA1/DSA", SIGN_ALIAS);
66 put("Alg.Alias.Signature.SHA/DSA", SIGN_ALIAS);
67 put("Alg.Alias.Signature.SHA-1/DSA", SIGN_ALIAS);
68 put("Alg.Alias.Signature.DSA", SIGN_ALIAS);
69 put("Alg.Alias.Signature.DSS", SIGN_ALIAS);
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080070
Elliott Hughesad416242011-01-06 18:13:31 -080071 put("Alg.Alias.Signature.OID.1.2.840.10040.4.3", SIGN_ALIAS);
72 put("Alg.Alias.Signature.1.2.840.10040.4.3", SIGN_ALIAS);
73 put("Alg.Alias.Signature.1.3.14.3.2.13", SIGN_ALIAS);
74 put("Alg.Alias.Signature.1.3.14.3.2.27", SIGN_ALIAS);
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080075
Elliott Hughesad416242011-01-06 18:13:31 -080076 put("KeyFactory.DSA", KEYF_NAME);
77 put("KeyFactory.DSA ImplementedIn", "Software");
78 put("Alg.Alias.KeyFactory.1.3.14.3.2.12", "DSA");
79 put("Alg.Alias.KeyFactory.1.2.840.10040.4.1", "DSA");
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080080 }
81}