get_cert¶
-
FunctionalityWrapper.
get_cert
(style='path', read_mode='r')[source] Returns the path to the used certificate or its content as string or bytes.
Parameters: - style ({'path', 'content'}, default 'path') – List of filepaths/content dicts in server_home/anon_root
- read_mode ({'r', 'rb'}, default 'r') – This only applies if style is ‘content’.
Mode in which files should be read (see
open("filepath", read_mode)
)
Returns: cert – Path to or content of the used certificate
Return type: str
Raises: TypeError
– If style is not astr
TypeError
– If read_mode is not astr
ValueError
– If the value of style is not ‘path’ or ‘content’ValueError
– If the value of read_mode is not ‘r’ or ‘rb’WrongFixtureError
– If used onftpserver
fixture, instead offtpserver_TLS
fixture.
Examples
>>> ftpserver_TLS.get_cert() "/home/certs/TLS_cert.pem"
>>> ftpserver_TLS.get_cert(style="content") "-----BEGIN RSA PRIVATE KEY-----\nMIICXw..."
>>> ftpserver_TLS.get_cert(style="content", read_mode="rb") b"-----BEGIN RSA PRIVATE KEY-----\nMIICXw..."