|
reSIProcate/stack
9694
|
00001 #ifndef RESIP_SecurityAttributes_hxx 00002 #define RESIP_SecurityAttributes_hxx 00003 00004 #include <iostream> 00005 00006 #include "rutil/Data.hxx" 00007 00008 namespace resip 00009 { 00010 00011 enum SignatureStatus 00012 { 00013 SignatureNone, // there is no signature 00014 SignatureIsBad, 00015 SignatureTrusted, // It is signed with trusted signature 00016 SignatureCATrusted, // signature is new and is signed by a root we trust 00017 SignatureNotTrusted, // signature is new and is not signed by a CA we 00018 SignatureSelfSigned 00019 }; 00020 00021 class SecurityAttributes 00022 { 00023 public: 00024 SecurityAttributes(); 00025 ~SecurityAttributes(); 00026 00027 typedef enum {None, Sign, Encrypt, SignAndEncrypt} OutgoingEncryptionLevel; 00028 00029 typedef enum {From, FailedIdentity, Identity} IdentityStrength; 00030 00031 SignatureStatus getSignatureStatus() const 00032 { 00033 return mSigStatus; 00034 } 00035 00036 bool isEncrypted() const 00037 { 00038 return mIsEncrypted; 00039 } 00040 void setEncrypted() 00041 { 00042 mIsEncrypted = true; 00043 } 00044 00045 void setSignatureStatus(SignatureStatus status) 00046 { 00047 mSigStatus = status; 00048 } 00049 00050 void setIdentity(const Data& identity) 00051 { 00052 mIdentity = identity; 00053 } 00054 00055 const Data& getIdentity() const 00056 { 00057 return mIdentity; 00058 } 00059 00060 void setIdentityStrength(IdentityStrength strength) 00061 { 00062 mStrength = strength; 00063 } 00064 00065 IdentityStrength getIdentityStrength() const 00066 { 00067 return mStrength; 00068 } 00069 00070 void setSigner(const Data& signer) 00071 { 00072 mSigner = signer; 00073 } 00074 00075 const Data& getSigner() const 00076 { 00077 return mSigner; 00078 } 00079 00080 OutgoingEncryptionLevel getOutgoingEncryptionLevel() const 00081 { 00082 return mLevel; 00083 } 00084 00085 void setOutgoingEncryptionLevel(OutgoingEncryptionLevel level) 00086 { 00087 mLevel = level; 00088 } 00089 00090 bool encryptionPerformed() const 00091 { 00092 return mEncryptionPerformed; 00093 } 00094 00095 void setEncryptionPerformed(bool performed) 00096 { 00097 mEncryptionPerformed = performed; 00098 } 00099 00100 friend EncodeStream& operator<<(EncodeStream& strm, const SecurityAttributes& sa); 00101 00102 private: 00103 bool mIsEncrypted; 00104 SignatureStatus mSigStatus; 00105 Data mSigner; 00106 Data mIdentity; 00107 IdentityStrength mStrength; 00108 OutgoingEncryptionLevel mLevel; // for outgoing messages. 00109 bool mEncryptionPerformed; 00110 }; 00111 00112 EncodeStream& operator<<(EncodeStream& strm, const SecurityAttributes& sa); 00113 } 00114 00115 #endif 00116 00117 /* ==================================================================== 00118 * The Vovida Software License, Version 1.0 00119 * 00120 * Copyright (c) 2000-2005 Vovida Networks, Inc. All rights reserved. 00121 * 00122 * Redistribution and use in source and binary forms, with or without 00123 * modification, are permitted provided that the following conditions 00124 * are met: 00125 * 00126 * 1. Redistributions of source code must retain the above copyright 00127 * notice, this list of conditions and the following disclaimer. 00128 * 00129 * 2. Redistributions in binary form must reproduce the above copyright 00130 * notice, this list of conditions and the following disclaimer in 00131 * the documentation and/or other materials provided with the 00132 * distribution. 00133 * 00134 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00135 * and "Vovida Open Communication Application Library (VOCAL)" must 00136 * not be used to endorse or promote products derived from this 00137 * software without prior written permission. For written 00138 * permission, please contact vocal@vovida.org. 00139 * 00140 * 4. Products derived from this software may not be called "VOCAL", nor 00141 * may "VOCAL" appear in their name, without prior written 00142 * permission of Vovida Networks, Inc. 00143 * 00144 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00145 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00146 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00147 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00148 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00149 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00150 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00151 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00152 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00153 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00154 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00155 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00156 * DAMAGE. 00157 * 00158 * ==================================================================== 00159 * 00160 * This software consists of voluntary contributions made by Vovida 00161 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00162 * Inc. For more information on Vovida Networks, Inc., please see 00163 * <http://www.vovida.org/>. 00164 * 00165 */
1.7.5.1