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: /**
019: * @author Aleksei Y. Semenov
020: * @version $Revision$
021: */package org.apache.harmony.security.tests.support;
022:
023: import java.io.IOException;
024: import java.io.InputStream;
025: import java.io.OutputStream;
026: import java.security.Certificate;
027: import java.security.KeyException;
028: import java.security.Principal;
029: import java.security.PublicKey;
030:
031: /**
032: * Stub for interface Certificate, necessary for testing
033: */
034:
035: public class CertificateStub implements Certificate {
036:
037: String format;
038: Principal guarantor;
039: Principal principal;
040: PublicKey key;
041:
042: public CertificateStub(String format, Principal guarantor,
043: Principal principal, PublicKey key) {
044: this .format = format;
045: this .guarantor = guarantor;
046: this .principal = principal;
047: this .key = key;
048: }
049:
050: /**
051: * Stub - does nothing
052: * @see java.security.Certificate#decode(java.io.InputStream)
053: */
054: public void decode(InputStream stream) throws KeyException,
055: IOException {
056:
057: }
058:
059: /**
060: * Stub - does nothing
061: * @see java.security.Certificate#encode(java.io.OutputStream)
062: */
063: public void encode(OutputStream stream) throws KeyException,
064: IOException {
065:
066: }
067:
068: /**
069: * @see java.security.Certificate#getFormat()
070: */
071: public String getFormat() {
072:
073: return format;
074: }
075:
076: /**
077: * @see java.security.Certificate#getGuarantor()
078: */
079: public Principal getGuarantor() {
080:
081: return guarantor;
082: }
083:
084: /**
085: * @see java.security.Certificate#getPrincipal()
086: */
087: public Principal getPrincipal() {
088: return principal;
089: }
090:
091: /**
092: * @see java.security.Certificate#getPublicKey()
093: */
094: public PublicKey getPublicKey() {
095: return key;
096: }
097:
098: /**
099: * Stub - returns <code>null</code>
100: * @see java.security.Certificate#toString(boolean)
101: */
102: public String toString(boolean detailed) {
103: return null;
104: }
105:
106: }
|