001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: /**
018: * @author Boris V. Kuznetsov
019: * @version $Revision$
020: */package org.apache.harmony.security.tests.support;
021:
022: import java.security.InvalidKeyException;
023: import java.security.InvalidParameterException;
024: import java.security.PrivateKey;
025: import java.security.PublicKey;
026: import java.security.Signature;
027: import java.security.SignatureException;
028:
029: /**
030: * Tests implementation of Signature
031: *
032: */
033: public class MySignature1 extends Signature {
034:
035: public boolean runEngineInitVerify = false;
036: public boolean runEngineInitSign = false;
037: public boolean runEngineUpdate1 = false;
038: public boolean runEngineUpdate2 = false;
039: public boolean runEngineSign = false;
040: public boolean runEngineVerify = false;
041: public boolean runEngineSetParameter = false;
042: public boolean runEngineGetParameter = false;
043:
044: /**
045: *
046: *
047: */
048: public MySignature1() {
049: super (null);
050: }
051:
052: /**
053: *
054: * @param algorithm
055: */
056: public MySignature1(String algorithm) {
057: super (algorithm);
058: }
059:
060: protected void engineInitVerify(PublicKey publicKey)
061: throws InvalidKeyException {
062: runEngineInitVerify = true;
063: }
064:
065: protected void engineInitSign(PrivateKey privateKey)
066: throws InvalidKeyException {
067: runEngineInitSign = true;
068: }
069:
070: protected void engineUpdate(byte b) throws SignatureException {
071: runEngineUpdate1 = true;
072: }
073:
074: protected void engineUpdate(byte[] b, int off, int len)
075: throws SignatureException {
076: runEngineUpdate2 = true;
077: }
078:
079: protected byte[] engineSign() throws SignatureException {
080: runEngineSign = true;
081: return null;
082: }
083:
084: protected boolean engineVerify(byte[] sigBytes)
085: throws SignatureException {
086: runEngineVerify = true;
087: return false;
088: }
089:
090: protected void engineSetParameter(String param, Object value)
091: throws InvalidParameterException {
092: runEngineSetParameter = true;
093: }
094:
095: protected Object engineGetParameter(String param)
096: throws InvalidParameterException {
097: runEngineGetParameter = true;
098: return null;
099: }
100:
101: public int getState() {
102: return state;
103: }
104: }
|