summaryrefslogtreecommitdiff
path: root/src/leap/common/certs.py
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-06-28 14:55:33 -0300
committerTomás Touceda <chiiph@leap.se>2013-06-28 14:55:33 -0300
commitd071efe20a285e579111f568e2ff994a6171249f (patch)
tree824ea959c02c8ed3af36c0cec8421e0748d311cc /src/leap/common/certs.py
parentb966eec96fd3621908baab8697de8e2ed61ba136 (diff)
parenta0f78f9d708cc6fe686ee5860cdc34909391b14b (diff)
Merge branch 'release-0.2.5'
Diffstat (limited to 'src/leap/common/certs.py')
-rw-r--r--src/leap/common/certs.py48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/leap/common/certs.py b/src/leap/common/certs.py
index 4cb70dd..4fe563b 100644
--- a/src/leap/common/certs.py
+++ b/src/leap/common/certs.py
@@ -35,10 +35,10 @@ def get_cert_from_string(string):
"""
Returns the x509 from the contents of this string
- @param string: certificate contents as downloaded
- @type string: str
+ :param string: certificate contents as downloaded
+ :type string: str
- @return: x509 or None
+ :return: x509 or None
"""
leap_assert(string, "We need something to load")
@@ -55,10 +55,10 @@ def get_privatekey_from_string(string):
"""
Returns the private key from the contents of this string
- @param string: private key contents as downloaded
- @type string: str
+ :param string: private key contents as downloaded
+ :type string: str
- @return: private key or None
+ :return: private key or None
"""
leap_assert(string, "We need something to load")
@@ -75,12 +75,12 @@ def get_digest(cert_data, method):
"""
Returns the digest for the cert_data using the method specified
- @param cert_data: certificate data in string form
- @type cert_data: str
- @param method: method to be used for digest
- @type method: str
+ :param cert_data: certificate data in string form
+ :type cert_data: str
+ :param method: method to be used for digest
+ :type method: str
- @rtype: str
+ :rtype: str
"""
x509 = get_cert_from_string(cert_data)
digest = x509.digest(method).replace(":", "").lower()
@@ -93,10 +93,10 @@ def can_load_cert_and_pkey(string):
Loads certificate and private key from a buffer, returns True if
everything went well, False otherwise
- @param string: buffer containing the cert and private key
- @type string: str or any kind of buffer
+ :param string: buffer containing the cert and private key
+ :type string: str or any kind of buffer
- @rtype: bool
+ :rtype: bool
"""
can_load = True
@@ -118,10 +118,10 @@ def is_valid_pemfile(cert):
"""
Checks that the passed string is a valid pem certificate
- @param cert: String containing pem content
- @type cert: str
+ :param cert: String containing pem content
+ :type cert: str
- @rtype: bool
+ :rtype: bool
"""
leap_assert(cert, "We need a cert to load")
@@ -132,10 +132,10 @@ def get_cert_time_boundaries(certfile):
"""
Returns the time boundaries for the certificate saved in certfile
- @param certfile: path to certificate
- @type certfile: str
+ :param certfile: path to certificate
+ :type certfile: str
- @rtype: tuple (from, to)
+ :rtype: tuple (from, to)
"""
cert = get_cert_from_string(certfile)
leap_assert(cert, 'There was a problem loading the certificate')
@@ -151,11 +151,11 @@ def should_redownload(certfile, now=time.gmtime):
"""
Returns True if any of the checks don't pass, False otherwise
- @param certfile: path to certificate
- @type certfile: str
- @param now: current date function, ONLY USED FOR TESTING
+ :param certfile: path to certificate
+ :type certfile: str
+ :param now: current date function, ONLY USED FOR TESTING
- @rtype: bool
+ :rtype: bool
"""
exists = os.path.isfile(certfile)