001/* 002 * Copyright 2017-2018 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright (C) 2017-2018 Ping Identity Corporation 007 * 008 * This program is free software; you can redistribute it and/or modify 009 * it under the terms of the GNU General Public License (GPLv2 only) 010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 011 * as published by the Free Software Foundation. 012 * 013 * This program is distributed in the hope that it will be useful, 014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 016 * GNU General Public License for more details. 017 * 018 * You should have received a copy of the GNU General Public License 019 * along with this program; if not, see <http://www.gnu.org/licenses>. 020 */ 021package com.unboundid.util.ssl.cert; 022 023 024 025import java.io.Serializable; 026 027import com.unboundid.util.NotExtensible; 028import com.unboundid.util.ThreadSafety; 029import com.unboundid.util.ThreadSafetyLevel; 030 031 032 033/** 034 * This class defines the parent class for a decoded private key that may appear 035 * in a PKCS #8 private key object. 036 */ 037@NotExtensible() 038@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE) 039public abstract class DecodedPrivateKey 040 implements Serializable 041{ 042 /** 043 * The serial version UID for this serializable class. 044 */ 045 private static final long serialVersionUID = 2801676658381861675L; 046 047 048 049 /** 050 * Retrieves a string representation of this decoded private key. 051 * 052 * @return A string representation of this decoded private key. 053 */ 054 @Override() 055 public final String toString() 056 { 057 final StringBuilder buffer = new StringBuilder(); 058 toString(buffer); 059 return buffer.toString(); 060 } 061 062 063 064 /** 065 * Appends a string representation of this decoded private key to the provided 066 * buffer. 067 * 068 * @param buffer The buffer to which the information should be appended. 069 */ 070 public abstract void toString(final StringBuilder buffer); 071}