1
1
import os
2
2
3
- import saml2 .aes
3
+ from saml2 .cryptography . symmetric import AESCipher
4
4
5
5
6
6
class TestAES ():
7
7
def test_aes_defaults (self ):
8
8
original_msg = b'ToBeOrNotTobe W.S.'
9
9
key = os .urandom (16 )
10
- aes = saml2 . aes . AESCipher (key )
10
+ aes = AESCipher (key )
11
11
12
12
encrypted_msg = aes .encrypt (original_msg )
13
13
decrypted_msg = aes .decrypt (encrypted_msg )
@@ -16,7 +16,7 @@ def test_aes_defaults(self):
16
16
def test_aes_128_cbc (self ):
17
17
original_msg = b'ToBeOrNotTobe W.S.'
18
18
key = os .urandom (16 )
19
- aes = saml2 . aes . AESCipher (key )
19
+ aes = AESCipher (key )
20
20
alg = 'aes_128_cbc'
21
21
22
22
encrypted_msg = aes .encrypt (original_msg , alg = alg )
@@ -26,7 +26,7 @@ def test_aes_128_cbc(self):
26
26
def test_aes_128_cfb (self ):
27
27
original_msg = b'ToBeOrNotTobe W.S.'
28
28
key = os .urandom (16 )
29
- aes = saml2 . aes . AESCipher (key )
29
+ aes = AESCipher (key )
30
30
alg = 'aes_128_cfb'
31
31
32
32
encrypted_msg = aes .encrypt (original_msg , alg = alg )
@@ -36,7 +36,7 @@ def test_aes_128_cfb(self):
36
36
def test_aes_192_cbc (self ):
37
37
original_msg = b'ToBeOrNotTobe W.S.'
38
38
key = os .urandom (24 )
39
- aes = saml2 . aes . AESCipher (key )
39
+ aes = AESCipher (key )
40
40
alg = 'aes_192_cbc'
41
41
42
42
encrypted_msg = aes .encrypt (original_msg , alg = alg )
@@ -46,7 +46,7 @@ def test_aes_192_cbc(self):
46
46
def test_aes_192_cfb (self ):
47
47
original_msg = b'ToBeOrNotTobe W.S.'
48
48
key = os .urandom (24 )
49
- aes = saml2 . aes . AESCipher (key )
49
+ aes = AESCipher (key )
50
50
alg = 'aes_192_cfb'
51
51
52
52
encrypted_msg = aes .encrypt (original_msg , alg = alg )
@@ -56,7 +56,7 @@ def test_aes_192_cfb(self):
56
56
def test_aes_256_cbc (self ):
57
57
original_msg = b'ToBeOrNotTobe W.S.'
58
58
key = os .urandom (32 )
59
- aes = saml2 . aes . AESCipher (key )
59
+ aes = AESCipher (key )
60
60
alg = 'aes_256_cbc'
61
61
62
62
encrypted_msg = aes .encrypt (original_msg , alg = alg )
@@ -66,7 +66,7 @@ def test_aes_256_cbc(self):
66
66
def test_aes_256_cfb (self ):
67
67
original_msg = b'ToBeOrNotTobe W.S.'
68
68
key = os .urandom (32 )
69
- aes = saml2 . aes . AESCipher (key )
69
+ aes = AESCipher (key )
70
70
alg = 'aes_256_cfb'
71
71
72
72
encrypted_msg = aes .encrypt (original_msg , alg = alg )
0 commit comments