1
|
import pytest
|
2
|
|
3
|
from src.services.cryptography import CryptographyService
|
4
|
|
5
|
|
6
|
@pytest.fixture
|
7
|
def service():
|
8
|
# provide a CryptographyService fixture
|
9
|
return CryptographyService()
|
10
|
|
11
|
|
12
|
@pytest.fixture
|
13
|
def private_key_pem():
|
14
|
return """
|
15
|
-----BEGIN RSA PRIVATE KEY-----
|
16
|
MIIEpgIBAAKCAQEA8Ue4iYHc7ECrdHij9JHLRPhw9YXsK09ojPZaMW+GnhJrh//V
|
17
|
uOlUsA3Qb2xrdpwcevpTy8+96FU+w/laDA0KGsRPDfZnRYFGfonzuhJKDNkU7p2H
|
18
|
sqKp+ttxNEFm2ZTPo9KvrvQrg286RUMu+b0e/PlSG9X3L/+OMx3GsblBbXKNQmSq
|
19
|
T5qdWmoFMRSR4Z7wufAGebJXBTn8Z5r1KkhLLViRYdWC4V9+/ZcCg8eMHG2StRGI
|
20
|
MutrhidznFaTvOSiw6ehdFmv7qlEeUPj6kiSHMe6duwrFP2p9fyp4hWjjW72CUhJ
|
21
|
JadXNzVk5/HPb/BxFGmpdkVvDZJbUQ17IotW9QIDAQABAoIBAQDUzohBp+t96LAQ
|
22
|
o1Mgo/Kf22xt8PfTX098fNAiKBaYlvCG3CvZ0tqiCR0dGYhS7e/ku6Nq8Mi0AXPB
|
23
|
j81PMbUG1LxROVHuqM3PT8dLB1SOrmza5NBJy1SW8DORflnDcJAPEwVnDu7OFy1S
|
24
|
56WoGZkaUKCN8pL5n7IA/bNBD39YkmkBonzWRhqaPnkq54chHpkg0a0dnGkftHbM
|
25
|
j6mY3s+LfK5TP+mSgGKD2eWBxEuYjYoqIZhGLQ3/L7dC8vBy7plfgpxaJkI8AQfg
|
26
|
SVg821yU3Ms65W8JEQga5sm0SPxbxUkoMvQR4WWsWLVszKoOZ8kQBLOTtHasC4WH
|
27
|
vXkg53khAoGBAPjz1BCYrhpPFlSiSnQ2sIS2GbqYIYVaSjCuDrmHzCQDJaGfrQs8
|
28
|
OZJDrikZUFxmSTKk38CUEqWQrhMR8YERnc5MgdYjX2HqmrBhFBrNMzH7EUVLhbRp
|
29
|
Dppe4DSB1b6P8lvaERrjmtPZ9FxZML8uJDw0aaVBKYVmKlJREnQP+ADNAoGBAPgc
|
30
|
Snsksn/GM4jVeHzkxw6uCuS//iek6lHMgEvpqdWnvN1X+KQipxZTQZV3OvhmgtJI
|
31
|
zg3Kv5TPn0Sr4oEw87eRGKQj0G/wh27fhe22beWrQMPxMq6R9ny/gvBnfxz/keIW
|
32
|
wAs3wRMHKiVub8FRMEdIOHEMeWrD+dfaGuuV5Y7JAoGBALelXsWTa7N6rfVm9td9
|
33
|
1H9Buf8c5HVz4pDAhZo1Y9EZBTSSDtvf5HRSOvKUeuR+i/axC2ILmSnLba4hqW7V
|
34
|
6PxbEdg+pckcgFomcudGgkKXe+kLSimI6j3UST5SnLODinxZhA664ebvvEQ3gy80
|
35
|
wYQsAdbnF9MRR50Lszos4XztAoGBAMQCnbjhif811zrP4stQdg4b41FKeIBbYh7T
|
36
|
X7wZUmoPhT6cpDsPgU864QIy2qypV8rHZ7ovpeDrkdjPrjcANFqeT4hFHwOAU459
|
37
|
GjJtQC8EdzsVT0Po3oE5TzmbmimPonGqJXf3SRo+O8ask69285ws6yIsh7OYNcaY
|
38
|
cVIS7vM5AoGBAPK2UieUMGTfK/SJ7tizApFkvonaInY8rKmiEeF9zuOxJBJ+mjXC
|
39
|
2dGH5h6itrdbQw7ykrnf4KgmS1ZDamrCYlhMRewbk1gzEvBV1I6W67DaMgIHxzrc
|
40
|
kXs8LBdrpkP93JM50KBFORHJvr9zmPjQ5VJdjipmqmwAI75qIBcdmlYG
|
41
|
-----END RSA PRIVATE KEY-----
|
42
|
"""
|
43
|
|
44
|
|
45
|
@pytest.fixture
|
46
|
def private_key_encrypted_pem():
|
47
|
return """
|
48
|
-----BEGIN RSA PRIVATE KEY-----
|
49
|
Proc-Type: 4,ENCRYPTED
|
50
|
DEK-Info: AES-256-CBC,3D2BFBB1BD0E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