mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-04-13 20:31:04 +00:00
* Move acme.py to acme/__init__.py to prepare splitup. * Began moving generic code out. * Creating backends. * Update unit tests. * Move remaining new code out. * Use new interface. * Rewrite module init code. * Add changelog. * Add BackendException for crypto backend errors. * Improve / uniformize ACME error reporting. * Create ACMELegacyAccount for backwards compatibility. * Split up ACMEAccount into ACMEClient and ACMEAccount. * Move get_keyauthorization into module_utils.acme.challenges. * Improve error handling. * Move challenge and authorization handling code into module_utils. * Add split_identifier helper. * Move order code into module_utils. * Move ACME v2 certificate handling code to module_utils. * Fix/move ACME v1 certificate retrieval to module_utils as well. * Refactor alternate chain handling code by splitting it up into simpler functions. * Make chain matcher creation part of backend.
77 lines
1.8 KiB
Python
77 lines
1.8 KiB
Python
from __future__ import absolute_import, division, print_function
|
|
__metaclass__ = type
|
|
|
|
|
|
import base64
|
|
import datetime
|
|
import os
|
|
|
|
|
|
def load_fixture(name):
|
|
with open(os.path.join(os.path.dirname(__file__), 'fixtures', name)) as f:
|
|
return f.read()
|
|
|
|
|
|
TEST_PEM_DERS = [
|
|
(
|
|
load_fixture('privatekey_1.pem'),
|
|
base64.b64decode('MHcCAQEEIDWajU0PyhYKeulfy/luNtkAve7DkwQ01bXJ97zbxB66oAo'
|
|
'GCCqGSM49AwEHoUQDQgAEAJz0yAAXAwEmOhTRkjXxwgedbWO6gobYM3'
|
|
'lWszrS68G8QSzhXR6AmQ3IzZDimnTTXO7XhVylDT8SLzE44/Epmw==')
|
|
)
|
|
]
|
|
|
|
|
|
TEST_KEYS = [
|
|
(
|
|
load_fixture('privatekey_1.pem'),
|
|
{
|
|
'alg': 'ES256',
|
|
'hash': 'sha256',
|
|
'jwk': {
|
|
'crv': 'P-256',
|
|
'kty': 'EC',
|
|
'x': 'AJz0yAAXAwEmOhTRkjXxwgedbWO6gobYM3lWszrS68E',
|
|
'y': 'vEEs4V0egJkNyM2Q4pp001zu14VcpQ0_Ei8xOOPxKZs',
|
|
},
|
|
'point_size': 32,
|
|
'type': 'ec',
|
|
},
|
|
load_fixture('privatekey_1.txt'),
|
|
)
|
|
]
|
|
|
|
|
|
TEST_CSRS = [
|
|
(
|
|
load_fixture('csr_1.pem'),
|
|
set([
|
|
('dns', 'ansible.com'),
|
|
('dns', 'example.com'),
|
|
('dns', 'example.org')
|
|
]),
|
|
load_fixture('csr_1.txt'),
|
|
),
|
|
(
|
|
load_fixture('csr_2.pem'),
|
|
set([
|
|
('dns', 'ansible.com'),
|
|
('ip', '127.0.0.1'),
|
|
('ip', '::1'),
|
|
('ip', '2001:d88:ac10:fe01::'),
|
|
('ip', '2001:1234:5678:abcd:9876:5432:10fe:dcba')
|
|
]),
|
|
load_fixture('csr_2.txt'),
|
|
),
|
|
]
|
|
|
|
|
|
TEST_CERT = load_fixture("cert_1.pem")
|
|
|
|
|
|
TEST_CERT_DAYS = [
|
|
(datetime.datetime(2018, 11, 15, 1, 2, 3), 11),
|
|
(datetime.datetime(2018, 11, 25, 15, 20, 0), 1),
|
|
(datetime.datetime(2018, 11, 25, 15, 30, 0), 0),
|
|
]
|