1/* 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 tests.support; 19 20import java.security.AccessController; 21import java.security.PrivilegedAction; 22import java.security.Provider; 23 24/** 25 * This class implements a dummy provider. 26 */ 27public class Support_ProviderTrust extends Provider { 28 private static final long serialVersionUID = 1L; 29 30 // Provider name 31 private static final String NAME = "ProviderTrust"; 32 33 // Version of the services 34 private static final double VERSION = 1.0; 35 36 private static final String INFO = NAME 37 + " DSA key, parameter generation and signing; SHA-1 digest; SHA1PRNG SecureRandom"; 38 39 /** 40 * Constructs a new instance of the dummy provider. 41 */ 42 public Support_ProviderTrust() { 43 super(NAME, VERSION, INFO); 44 registerServices(); 45 } 46 47 /** 48 * Register the services the receiver provides. 49 */ 50 private void registerServices() { 51 AccessController.doPrivileged(new PrivilegedAction<Void>() { 52 public Void run() { 53 // Digest engine 54 put("MessageDigest.SHA", 55 "made.up.provider.name.MessageDigestSHA"); 56 put("MessageDigest.MD5", 57 "made.up.provider.name.MessageDigestMD5"); 58 59 // Algorithm parameter generator 60 put("AlgorithmParameterGenerator.DSA", 61 "made.up.provider.name.AlgorithmParameterGeneratorDSA"); 62 63 // Algorithm parameters 64 put("AlgorithmParameters.DSA", 65 "made.up.provider.name.AlgorithmParametersDSA"); 66 67 // Key pair generator 68 put("KeyPairGenerator.DSA", 69 "made.up.provider.name.KeyPairGeneratorDSA"); 70 71 // Key factory 72 put("KeyFactory.DSA", "made.up.provider.name.KeyFactoryDSA"); 73 put("KeyFactory.RSA", "made.up.provider.name.KeyFactoryRSA"); 74 75 // Signature algorithm 76 put("Signature.SHA1withDSA", 77 "made.up.provider.name.SignatureDSA"); 78 79 // KeyStore 80 put("KeyStore.PKCS#12/Netscape", 81 "made.up.provider.name.KeyStore"); 82 83 // Certificate 84 put("CertificateFactory.X509", 85 "made.up.provider.name.CertificateFactoryX509"); 86 87 return null; 88 } 89 }); 90 } 91}