1
by Auélien DUMAINE
INIT BRANCH |
1 |
# -*- coding: utf-8 -*-
|
2
by Auélien DUMAINE
FDL process |
2 |
##############################################################################
|
3 |
#
|
|
4 |
# ebicspy, EBICS protocol library
|
|
5 |
# Copyright (C) 2013-2014 Aurélien DUMAINE (aurelien.dumaine@free.fr).
|
|
6 |
#
|
|
7 |
# This program is free software: you can redistribute it and/or modify
|
|
8 |
# it under the terms of the GNU Affero General Public License as
|
|
9 |
# published by the Free Software Foundation, either version 3 of the
|
|
10 |
# License, or (at your option) any later version.
|
|
11 |
#
|
|
12 |
# This program is distributed in the hope that it will be useful,
|
|
13 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 |
# GNU Affero General Public License for more details.
|
|
16 |
#
|
|
17 |
# You should have received a copy of the GNU Affero General Public License
|
|
18 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19 |
#
|
|
20 |
##############################################################################
|
|
1
by Auélien DUMAINE
INIT BRANCH |
21 |
|
3
by Auélien DUMAINE
Key storage |
22 |
import httplib |
13
by Auélien DUMAINE
HTTPSEngine debug |
23 |
import urllib2 |
24 |
import os |
|
14
by Auélien DUMAINE
INI and HIA request OK on QualifEBICS |
25 |
from tools import * |
13
by Auélien DUMAINE
HTTPSEngine debug |
26 |
os.environ['http_proxy'] = '' |
3
by Auélien DUMAINE
Key storage |
27 |
|
1
by Auélien DUMAINE
INIT BRANCH |
28 |
class HTTPSEngine : |
29 |
def __init__(self, partner, bank) : |
|
9
by Auélien DUMAINE
Crypto tools |
30 |
self.bank = bank |
31 |
self.partner = partner |
|
51
by Auélien DUMAINE
Debug : use the bank key to verify auth signature in check_AuthSignature_node. Add the fileExchangedLogger parameter. |
32 |
self.fileExchangedLogger = partner.getFileExchangedLogger() |
1
by Auélien DUMAINE
INIT BRANCH |
33 |
|
9
by Auélien DUMAINE
Crypto tools |
34 |
def send(self, xml): |
35 |
#TODO : check xml with xsd ? redondant ?
|
|
13
by Auélien DUMAINE
HTTPSEngine debug |
36 |
url_host = self.bank.getUrlHost() |
37 |
url_port = self.bank.getUrlPort() |
|
38 |
url_root = self.bank.getUrlRoot() |
|
39 |
whole_url = url_host+':'+str(url_port)+url_root |
|
40 |
||
49
by Auélien DUMAINE
Cleaning : deletion of the hardcoded value in get_orderData_signature of crypto_tools.py |
41 |
#TODO : check server certificate validity with the CA chain
|
9
by Auélien DUMAINE
Crypto tools |
42 |
xml_utf8 = xml #TODO : check utf8 |
49
by Auélien DUMAINE
Cleaning : deletion of the hardcoded value in get_orderData_signature of crypto_tools.py |
43 |
|
62
by Auélien DUMAINE
API various changes + key generation and storage API changes |
44 |
self.fileExchangedLogger.logMessage('request_'+get_timestamp()+'.xml', xml_utf8) |
13
by Auélien DUMAINE
HTTPSEngine debug |
45 |
|
24
by Auélien DUMAINE
New get_xxx_auth_sign function. OK on HPB, KO on FDL, works fine with example |
46 |
# TODO : verify the server certificate before exchange files
|
9
by Auélien DUMAINE
Crypto tools |
47 |
headers = {"Content-type": "text/xml; charset=UTF-8", "Accept": "text/xml", "Content-length" : str(len(xml_utf8))} |
13
by Auélien DUMAINE
HTTPSEngine debug |
48 |
request = urllib2.Request(whole_url, headers=headers) |
49 |
request.get_method = lambda: 'POST' |
|
50 |
request.add_data(xml_utf8) |
|
51 |
response = urllib2.urlopen(request) |
|
17
by Auélien DUMAINE
HPB decrypt |
52 |
response_content = response.read() |
49
by Auélien DUMAINE
Cleaning : deletion of the hardcoded value in get_orderData_signature of crypto_tools.py |
53 |
|
62
by Auélien DUMAINE
API various changes + key generation and storage API changes |
54 |
self.fileExchangedLogger.logMessage('response_'+get_timestamp()+'.xml', response_content) |
49
by Auélien DUMAINE
Cleaning : deletion of the hardcoded value in get_orderData_signature of crypto_tools.py |
55 |
|
17
by Auélien DUMAINE
HPB decrypt |
56 |
return response_content |
8
by Auélien DUMAINE
tabulation adjust |
57 |
|
58 |
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4
|