01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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: /**
18: * @author Boris V. Kuznetsov
19: * @version $Revision$
20: */package org.apache.harmony.security.tests.support;
21:
22: import java.security.InvalidKeyException;
23: import java.security.InvalidParameterException;
24: import java.security.PrivateKey;
25: import java.security.PublicKey;
26: import java.security.SignatureException;
27: import java.security.SignatureSpi;
28:
29: /**
30: * Tests implementation of Signature
31: *
32: */
33: public class MySignature2 extends SignatureSpi {
34:
35: public static boolean runEngineInitVerify = false;
36: public static boolean runEngineInitSign = false;
37: public static boolean runEngineUpdate1 = false;
38: public static boolean runEngineUpdate2 = false;
39: public static boolean runEngineSign = false;
40: public static boolean runEngineVerify = false;
41: public static boolean runEngineSetParameter = false;
42: public static boolean runEngineGetParameter = false;
43:
44: protected void engineInitVerify(PublicKey publicKey)
45: throws InvalidKeyException {
46: runEngineInitVerify = true;
47: }
48:
49: protected void engineInitSign(PrivateKey privateKey)
50: throws InvalidKeyException {
51: runEngineInitSign = true;
52: }
53:
54: protected void engineUpdate(byte b) throws SignatureException {
55: runEngineUpdate1 = true;
56: }
57:
58: protected void engineUpdate(byte[] b, int off, int len)
59: throws SignatureException {
60: runEngineUpdate2 = true;
61: }
62:
63: protected byte[] engineSign() throws SignatureException {
64: runEngineSign = true;
65: return null;
66: }
67:
68: protected boolean engineVerify(byte[] sigBytes)
69: throws SignatureException {
70: runEngineVerify = true;
71: return false;
72: }
73:
74: protected void engineSetParameter(String param, Object value)
75: throws InvalidParameterException {
76: runEngineSetParameter = true;
77: }
78:
79: protected Object engineGetParameter(String param)
80: throws InvalidParameterException {
81: runEngineGetParameter = true;
82: return null;
83: }
84: }
|