a2b1d89f8f63100847ce88574b15205513a76055
[shibboleth/cpp-xmltooling.git] / xmltooling / security / X509Credential.h
1 /*
2  *  Copyright 2001-2010 Internet2
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * @file xmltooling/security/X509Credential.h
19  * 
20  * Wraps an X.509-based Credential. 
21  */
22
23 #if !defined(__xmltooling_x509cred_h__) && !defined(XMLTOOLING_NO_XMLSEC)
24 #define __xmltooling_x509cred_h__
25
26 #include <xmltooling/security/Credential.h>
27
28 class XSECCryptoX509;
29
30 namespace xmltooling {
31
32     class XMLTOOL_API XSECCryptoX509CRL;
33
34     /**
35      * Wraps an X.509-based Credential.
36      */
37     class XMLTOOL_API X509Credential : public virtual Credential
38     {
39     protected:
40         X509Credential();
41         
42     public:
43         virtual ~X509Credential();
44
45         /**
46          * Bitmask constants for limiting resolution process inside a CredentialResolver. 
47          */
48         enum ResolveTypes {
49             RESOLVE_CERTS = 4,
50             RESOLVE_CRLS = 8
51         };
52
53         /**
54          * Bitmask of supported KeyInfo content to generate. 
55          */
56         enum KeyInfoTypes {
57             KEYINFO_X509_CERTIFICATE = 4,
58             KEYINFO_X509_SUBJECTNAME = 8,
59             KEYINFO_X509_ISSUERSERIAL = 16,
60             KEYINFO_X509_DIGEST = 32
61         };
62
63         /**
64          * Gets an immutable collection of certificates in the entity's trust chain. The entity certificate is contained
65          * within this list. No specific ordering of the certificates is guaranteed.
66          * 
67          * @return a certificate chain
68          */
69         virtual const std::vector<XSECCryptoX509*>& getEntityCertificateChain() const=0;
70
71         /**
72          * @deprecated
73          *
74          * Gets a CRL associated with the credential.
75          * 
76          * @return CRL associated with the credential
77          */
78         virtual XSECCryptoX509CRL* getCRL() const=0;
79
80         /**
81          * Gets an immutable collection of all CRLs associated with the credential.
82          * 
83          * @return CRLs associated with the credential
84          */
85         virtual const std::vector<XSECCryptoX509CRL*>& getCRLs() const=0;
86
87
88         /**
89          * Gets the subject name of the first certificate in the chain.
90          *
91          * @return the Subject DN
92          */
93         virtual const char* getSubjectName() const=0;
94
95         /**
96          * Gets the issuer name of the first certificate in the chain.
97          *
98          * @return the Issuer DN
99          */
100         virtual const char* getIssuerName() const=0;
101
102         /**
103          * Gets the serial number of the first certificate in the chain.
104          *
105          * @return the serial number
106          */
107         virtual const char* getSerialNumber() const=0;
108
109         /**
110          * Extracts properties like issuer and subject from the first certificate in the chain.
111          */
112         virtual void extract()=0;
113     };
114 };
115
116 #endif /* __xmltooling_x509cred_h__ */