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
18/**
19* @author Aleksei Y. Semenov
20* @version $Revision$
21*/
22
23package org.apache.harmony.security.tests.support;
24
25import java.io.IOException;
26import java.io.InputStream;
27import java.io.OutputStream;
28import java.security.Certificate;
29import java.security.KeyException;
30import java.security.Principal;
31import java.security.PublicKey;
32
33/**
34 * Stub for interface Certificate, necessary for testing
35 */
36@SuppressWarnings("deprecation")
37public class CertificateStub implements Certificate {
38
39    String format;
40    Principal guarantor;
41    Principal principal;
42    PublicKey key;
43
44    public CertificateStub(String format, Principal guarantor, Principal principal, PublicKey key){
45        this.format = format;
46        this.guarantor = guarantor;
47        this.principal = principal;
48        this.key = key;
49    }
50
51    /**
52     * Stub - does nothing
53     * @see java.security.Certificate#decode(java.io.InputStream)
54     */
55    public void decode(InputStream stream) throws KeyException,
56            IOException {
57
58
59    }
60
61    /**
62     * Stub - does nothing
63     * @see java.security.Certificate#encode(java.io.OutputStream)
64     */
65    public void encode(OutputStream stream) throws KeyException,
66            IOException {
67
68
69    }
70
71    /**
72     * @see java.security.Certificate#getFormat()
73     */
74    public String getFormat() {
75
76        return format;
77    }
78
79    /**
80     * @see java.security.Certificate#getGuarantor()
81     */
82    public Principal getGuarantor() {
83
84        return guarantor;
85    }
86
87    /**
88     * @see java.security.Certificate#getPrincipal()
89     */
90    public Principal getPrincipal() {
91        return principal;
92    }
93
94    /**
95     * @see java.security.Certificate#getPublicKey()
96     */
97    public PublicKey getPublicKey() {
98        return key;
99    }
100
101    /**
102     * Stub - returns <code>null</code>
103     * @see java.security.Certificate#toString(boolean)
104     */
105    public String toString(boolean detailed) {
106        return null;
107    }
108
109}
110