source: TI12-security/trunk/python/Tests/SessionMgrIOtest.py @ 738

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/Tests/SessionMgrIOtest.py@738
Revision 738, 8.6 KB checked in by pjkersha, 15 years ago (diff)

Moved this code from SessionMgrIO.

Line 
1#!/bin/env python
2                                       
3#_____________________________________________________________________________   
4if __name__ == "__main__":
5     # Client side - Set up input for SessionMgr WSDL connect()
6#    cr = ConnectReq(userName="WileECoyote",
7#                    pPhrase="ACME Road Runner catcher",
8#                    encrPubKeyFilePath="../certs/badc-aa-cert.pem")
9
10    # Server side - decrypt connectReq from connect() request
11#    cr = ConnectReq(encrXMLtxt=open("../Tests/xmlsec/connectReq.xml").read(),
12#                  encrPriKeyFilePath="../certs/badc-aa-key.pem",
13#                  encrPriKeyPwd="    ")
14
15    # Server side - make a connect response message
16#    cr1 = ConnectResp(sessCookie="A proxy certificate")
17#
18#    cr2 = ConnectResp(sessCookie="A session cookie",
19#                      encrPubKeyFilePath="../certs/badc-aa-cert.pem")
20                 
21#    import pdb
22#    pdb.set_trace()
23   
24    extAttCertList = [
25"""<?xml version="1.0"?>
26<attributeCertificate>
27    <acInfo>
28        <version>1.0</version>
29        <holder>/CN=pjkersha/O=NDG/OU=BADC</holder>
30        <issuer>/CN=Attribute Authority/O=NDG/OU=BADC</issuer>
31        <issuerName>BADC</issuerName>
32        <issuerSerialNumber>6578</issuerSerialNumber>
33    <validity>
34          <notBefore>2005 09 16 11 53 36</notBefore>
35        <notAfter>2005 09 16 19 53 29</notAfter>
36    </validity>
37    <attributes>
38        <roleSet>
39                <role>
40                <name>government</name>
41        </role>
42        </roleSet>
43    </attributes>
44    <provenance>original</provenance>
45    </acInfo>
46<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
47<SignedInfo>
48<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
49<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
50<Reference>
51<Transforms>
52<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
53</Transforms>
54<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
55<DigestValue>i1q2jwEDy0Sxc+ChxW9p4KCBynU=</DigestValue>
56</Reference>
57</SignedInfo>
58<SignatureValue>aXmExRkD4mZ9OdSlUcVUPIZ/r5v31Dq6IwU7Ox2/evd6maZeECVH4kGvGGez2VA5
59lKhghRqgmAPsgEfZlZ3XwFxxo8tQuY6pi19OqwLV51R5klysX6fKkyK2JVoUG8Y3
607fACirNGZrZyf93X8sTvd02xN1DOTp7zt1afDsu3qGE=</SignatureValue>
61<KeyInfo>
62<X509Data>
63
64
65
66<X509Certificate>MIICKDCCAZGgAwIBAgICGbIwDQYJKoZIhvcNAQEEBQAwYTEMMAoGA1UEChMDTkRH
67MQ0wCwYDVQQLEwRCQURDMScwJQYDVQQLFB5uZGdwdXJzZWNhQGZvZWhuLmJhZGMu
68cmwuYWMudWsxGTAXBgNVBAMTEEdsb2J1cyBTaW1wbGUgQ0EwHhcNMDUwODExMTQ1
69NjM4WhcNMDYwODExMTQ1NjM4WjA7MQwwCgYDVQQKEwNOREcxDTALBgNVBAsTBEJB
70REMxHDAaBgNVBAMTE0F0dHJpYnV0ZSBBdXRob3JpdHkwgZ8wDQYJKoZIhvcNAQEB
71BQADgY0AMIGJAoGBALgmuDF/jKxKlCMqhF835Yge6rHxZFLby9BbXGsa2pa/1BAY
72xJUiou8sIXO7yaWaRP7M9FwW64Vdk+HQI5zluG2Gtx4MgKYElUDCgPYXsvAXg0QG
73bo0KSPr+X489j07HegXGjekNejLwwvB7qTSqxHjAaKAKL7vBfWf5mn0mlIwbAgMB
74AAGjFTATMBEGCWCGSAGG+EIBAQQEAwIE8DANBgkqhkiG9w0BAQQFAAOBgQAmmqnd
75rj6mgbaruLepn5pyh8sQ+Qd7fwotW00rEBRYzJNUUObmIry5ZM5zuVMcaPSY57qY
76vWqnavydIPdu6N97/Tf/RLk8crLVOrqj2Mo0bwgnEnjmrQicIDsWj6bFNsX1kr6V
77MtUg6T1zo/Yz1aYgGcW4A/ws5tmcEHS0PUGIGA==</X509Certificate>
78<X509SubjectName>CN=Attribute Authority,OU=BADC,O=NDG</X509SubjectName>
79<X509IssuerSerial>
80<X509IssuerName>CN=Globus Simple CA,OU=ndgpurseca@foehn.badc.rl.ac.uk,OU=BADC,O=NDG</X509IssuerName>
81<X509SerialNumber>6578</X509SerialNumber>
82</X509IssuerSerial>
83</X509Data>
84</KeyInfo>
85</Signature></attributeCertificate>""",
86"""<?xml version="1.0"?>
87<attributeCertificate>
88    <acInfo>
89        <version>1.0</version>
90        <holder>/CN=pjkersha/O=NDG/OU=BADC</holder>
91        <issuer>/CN=Attribute Authority/O=NDG/OU=BADC</issuer>
92        <issuerName>BADC</issuerName>
93        <issuerSerialNumber>6578</issuerSerialNumber>
94    <validity>
95          <notBefore>2005 09 29 15 45 49</notBefore>
96        <notAfter>2005 09 29 23 45 49</notAfter>
97    </validity>
98    <attributes>
99        <roleSet>
100                <role>
101                <name>government</name>
102        </role>
103        </roleSet>
104    </attributes>
105    <provenance>original</provenance>
106    </acInfo>
107<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
108<SignedInfo>
109<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
110<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
111<Reference>
112<Transforms>
113<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
114</Transforms>
115<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
116<DigestValue>/Kw9IbBQuQAdNYAgvp2m01l663k=</DigestValue>
117</Reference>
118</SignedInfo>
119<SignatureValue>Q7lhq/jt+m2trRPyWrZ6BQcIibXrstVS/xKTAhR4puv7kVngIm64r45MJ2GQpQan
120QaVdVuOl8QPX8ila0j8sIz47FtriRWZ8fCssFYWR/7n3AKjNd22ChAshxHfZCJY4
121fzJSXgEN+FN0ArOWT49FbhDVf7LEGO+MR+TP+ZKt6uY=</SignatureValue>
122<KeyInfo>
123<X509Data>
124
125
126
127<X509Certificate>MIICKDCCAZGgAwIBAgICGbIwDQYJKoZIhvcNAQEEBQAwYTEMMAoGA1UEChMDTkRH
128MQ0wCwYDVQQLEwRCQURDMScwJQYDVQQLFB5uZGdwdXJzZWNhQGZvZWhuLmJhZGMu
129cmwuYWMudWsxGTAXBgNVBAMTEEdsb2J1cyBTaW1wbGUgQ0EwHhcNMDUwODExMTQ1
130NjM4WhcNMDYwODExMTQ1NjM4WjA7MQwwCgYDVQQKEwNOREcxDTALBgNVBAsTBEJB
131REMxHDAaBgNVBAMTE0F0dHJpYnV0ZSBBdXRob3JpdHkwgZ8wDQYJKoZIhvcNAQEB
132BQADgY0AMIGJAoGBALgmuDF/jKxKlCMqhF835Yge6rHxZFLby9BbXGsa2pa/1BAY
133xJUiou8sIXO7yaWaRP7M9FwW64Vdk+HQI5zluG2Gtx4MgKYElUDCgPYXsvAXg0QG
134bo0KSPr+X489j07HegXGjekNejLwwvB7qTSqxHjAaKAKL7vBfWf5mn0mlIwbAgMB
135AAGjFTATMBEGCWCGSAGG+EIBAQQEAwIE8DANBgkqhkiG9w0BAQQFAAOBgQAmmqnd
136rj6mgbaruLepn5pyh8sQ+Qd7fwotW00rEBRYzJNUUObmIry5ZM5zuVMcaPSY57qY
137vWqnavydIPdu6N97/Tf/RLk8crLVOrqj2Mo0bwgnEnjmrQicIDsWj6bFNsX1kr6V
138MtUg6T1zo/Yz1aYgGcW4A/ws5tmcEHS0PUGIGA==</X509Certificate>
139<X509SubjectName>CN=Attribute Authority,OU=BADC,O=NDG</X509SubjectName>
140<X509IssuerSerial>
141<X509IssuerName>CN=Globus Simple CA,OU=ndgpurseca@foehn.badc.rl.ac.uk,OU=BADC,O=NDG</X509IssuerName>
142<X509SerialNumber>6578</X509SerialNumber>
143</X509IssuerSerial>
144</X509Data>
145</KeyInfo>
146</Signature></attributeCertificate>""",
147"""<?xml version="1.0"?>
148<attributeCertificate>
149    <acInfo>
150        <version>1.0</version>
151        <holder>/CN=pjkersha/O=NDG/OU=BADC</holder>
152        <issuer>/CN=Attribute Authority/O=NDG/OU=BADC</issuer>
153        <issuerName>BADC</issuerName>
154        <issuerSerialNumber>6578</issuerSerialNumber>
155    <validity>
156          <notBefore>2005 09 16 10 19 32</notBefore>
157        <notAfter>2005 09 16 18 19 14</notAfter>
158    </validity>
159    <attributes>
160        <roleSet>
161                <role>
162                <name>government</name>
163        </role>
164        </roleSet>
165    </attributes>
166    <provenance>original</provenance>
167    </acInfo>
168<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
169<SignedInfo>
170<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
171<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
172<Reference>
173<Transforms>
174<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
175</Transforms>
176<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
177<DigestValue>tvftcf7fevu4PQqK2PhGFVzZlFo=</DigestValue>
178</Reference>
179</SignedInfo>
180<SignatureValue>cga7gcRSeKkI8+k5HiRdfxDz0wRA741lRaI0FCZ0e7rJH3IwxEv6C3fNB0a8Slgv
181R2/1b+xCHtNX0jaMLDnAv/AvtC8DfcV8yiDZOAQ/qXDkASB2OHDo6qM+Zlkf97U+
182dbjIuZ6bgXa2c9OlT9PUiCcDZt6uLmiu//28ZnFy7Pw=</SignatureValue>
183<KeyInfo>
184<X509Data>
185
186
187
188<X509Certificate>MIICKDCCAZGgAwIBAgICGbIwDQYJKoZIhvcNAQEEBQAwYTEMMAoGA1UEChMDTkRH
189MQ0wCwYDVQQLEwRCQURDMScwJQYDVQQLFB5uZGdwdXJzZWNhQGZvZWhuLmJhZGMu
190cmwuYWMudWsxGTAXBgNVBAMTEEdsb2J1cyBTaW1wbGUgQ0EwHhcNMDUwODExMTQ1
191NjM4WhcNMDYwODExMTQ1NjM4WjA7MQwwCgYDVQQKEwNOREcxDTALBgNVBAsTBEJB
192REMxHDAaBgNVBAMTE0F0dHJpYnV0ZSBBdXRob3JpdHkwgZ8wDQYJKoZIhvcNAQEB
193BQADgY0AMIGJAoGBALgmuDF/jKxKlCMqhF835Yge6rHxZFLby9BbXGsa2pa/1BAY
194xJUiou8sIXO7yaWaRP7M9FwW64Vdk+HQI5zluG2Gtx4MgKYElUDCgPYXsvAXg0QG
195bo0KSPr+X489j07HegXGjekNejLwwvB7qTSqxHjAaKAKL7vBfWf5mn0mlIwbAgMB
196AAGjFTATMBEGCWCGSAGG+EIBAQQEAwIE8DANBgkqhkiG9w0BAQQFAAOBgQAmmqnd
197rj6mgbaruLepn5pyh8sQ+Qd7fwotW00rEBRYzJNUUObmIry5ZM5zuVMcaPSY57qY
198vWqnavydIPdu6N97/Tf/RLk8crLVOrqj2Mo0bwgnEnjmrQicIDsWj6bFNsX1kr6V
199MtUg6T1zo/Yz1aYgGcW4A/ws5tmcEHS0PUGIGA==</X509Certificate>
200<X509SubjectName>CN=Attribute Authority,OU=BADC,O=NDG</X509SubjectName>
201<X509IssuerSerial>
202<X509IssuerName>CN=Globus Simple CA,OU=ndgpurseca@foehn.badc.rl.ac.uk,OU=BADC,O=NDG</X509IssuerName>
203<X509SerialNumber>6578</X509SerialNumber>
204</X509IssuerSerial>
205</X509Data>
206</KeyInfo>
207</Signature></attributeCertificate>"""
208]
209
210    ar1 = AuthorisationResp(extAttCertList=extAttCertList,
211                            statCode=AuthorisationResp.accessDenied,
212                            errMsg="User is not registered at data centre")
213#    import pdb
214#    pdb.set_trace()                         
215
216    ar2 = AuthorisationResp(xmlTxt=str(ar1))
217   
218    # check XMLSecDoc.__del__ error
219    del ar1
220    del ar2
Note: See TracBrowser for help on using the repository browser.