/src/resiprocate/resip/stack/SecurityAttributes.hxx
Line | Count | Source |
1 | | #ifndef RESIP_SecurityAttributes_hxx |
2 | | #define RESIP_SecurityAttributes_hxx |
3 | | |
4 | | #include <iostream> |
5 | | |
6 | | #include "rutil/Data.hxx" |
7 | | |
8 | | namespace resip |
9 | | { |
10 | | |
11 | | enum SignatureStatus |
12 | | { |
13 | | SignatureNone, // there is no signature |
14 | | SignatureIsBad, |
15 | | SignatureTrusted, // It is signed with trusted signature |
16 | | SignatureCATrusted, // signature is new and is signed by a root we trust |
17 | | SignatureNotTrusted, // signature is new and is not signed by a CA we |
18 | | SignatureSelfSigned |
19 | | }; |
20 | | |
21 | | class SecurityAttributes |
22 | | { |
23 | | public: |
24 | | SecurityAttributes(); |
25 | | SecurityAttributes(const SecurityAttributes& rhs); |
26 | | ~SecurityAttributes(); |
27 | | |
28 | | typedef enum {None, Sign, Encrypt, SignAndEncrypt} OutgoingEncryptionLevel; |
29 | | |
30 | | typedef enum {From, FailedIdentity, Identity} IdentityStrength; |
31 | | |
32 | 0 | void setIdentity(const Data& identity) { mIdentity = identity; } |
33 | 0 | const Data& getIdentity() const { return mIdentity; } |
34 | | |
35 | 0 | void setIdentityStrength(IdentityStrength strength) { mStrength = strength; } |
36 | 0 | IdentityStrength getIdentityStrength() const { return mStrength; } |
37 | | |
38 | 0 | void setEncrypted() { mIsEncrypted = true; } |
39 | 0 | bool isEncrypted() const { return mIsEncrypted; } |
40 | | |
41 | 0 | void setSignatureStatus(SignatureStatus status) { mSigStatus = status; } |
42 | 0 | SignatureStatus getSignatureStatus() const { return mSigStatus; } |
43 | | |
44 | 0 | void setSigner(const Data& signer) { mSigner = signer; } |
45 | 0 | const Data& getSigner() const { return mSigner; } |
46 | | |
47 | 0 | void setOutgoingEncryptionLevel(OutgoingEncryptionLevel level) { mLevel = level; } |
48 | 0 | OutgoingEncryptionLevel getOutgoingEncryptionLevel() const { return mLevel; } |
49 | | |
50 | 0 | void setEncryptionPerformed(bool performed) { mEncryptionPerformed = performed; } |
51 | 0 | bool encryptionPerformed() const { return mEncryptionPerformed; } |
52 | | |
53 | | friend EncodeStream& operator<<(EncodeStream& strm, const SecurityAttributes& sa); |
54 | | |
55 | | private: |
56 | | // Indentity Header Info |
57 | | Data mIdentity; |
58 | | IdentityStrength mStrength; |
59 | | |
60 | | // Body Encryption Info |
61 | | bool mIsEncrypted; |
62 | | SignatureStatus mSigStatus; |
63 | | Data mSigner; |
64 | | // for outgoing messages. |
65 | | OutgoingEncryptionLevel mLevel; |
66 | | bool mEncryptionPerformed; |
67 | | }; |
68 | | |
69 | | EncodeStream& operator<<(EncodeStream& strm, const SecurityAttributes& sa); |
70 | | } |
71 | | |
72 | | #endif |
73 | | |
74 | | /* ==================================================================== |
75 | | * The Vovida Software License, Version 1.0 |
76 | | * |
77 | | * Copyright (c) 2026 SIP Spectrum, Inc. https://www.sipspectrum.com |
78 | | * Copyright (c) 2000-2005 Vovida Networks, Inc. All rights reserved. |
79 | | * |
80 | | * Redistribution and use in source and binary forms, with or without |
81 | | * modification, are permitted provided that the following conditions |
82 | | * are met: |
83 | | * |
84 | | * 1. Redistributions of source code must retain the above copyright |
85 | | * notice, this list of conditions and the following disclaimer. |
86 | | * |
87 | | * 2. Redistributions in binary form must reproduce the above copyright |
88 | | * notice, this list of conditions and the following disclaimer in |
89 | | * the documentation and/or other materials provided with the |
90 | | * distribution. |
91 | | * |
92 | | * 3. The names "VOCAL", "Vovida Open Communication Application Library", |
93 | | * and "Vovida Open Communication Application Library (VOCAL)" must |
94 | | * not be used to endorse or promote products derived from this |
95 | | * software without prior written permission. For written |
96 | | * permission, please contact vocal@vovida.org. |
97 | | * |
98 | | * 4. Products derived from this software may not be called "VOCAL", nor |
99 | | * may "VOCAL" appear in their name, without prior written |
100 | | * permission of Vovida Networks, Inc. |
101 | | * |
102 | | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED |
103 | | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
104 | | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND |
105 | | * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA |
106 | | * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES |
107 | | * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, |
108 | | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
109 | | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
110 | | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
111 | | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
112 | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE |
113 | | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
114 | | * DAMAGE. |
115 | | * |
116 | | * ==================================================================== |
117 | | * |
118 | | * This software consists of voluntary contributions made by Vovida |
119 | | * Networks, Inc. and many individuals on behalf of Vovida Networks, |
120 | | * Inc. For more information on Vovida Networks, Inc., please see |
121 | | * <http://www.vovida.org/>. |
122 | | * |
123 | | */ |