Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
marcus.hardt
pluto
Commits
63fed8f7
Commit
63fed8f7
authored
Oct 14, 2014
by
marcus-tun
Browse files
added AES support
parent
edb88c64
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/sso.py
View file @
63fed8f7
...
...
@@ -7,6 +7,7 @@ import hashlib
from
base64
import
b64encode
,
b64decode
from
Crypto.Cipher
import
Blowfish
from
Crypto.Cipher
import
AES
from
Crypto
import
Random
from
struct
import
pack
...
...
@@ -176,15 +177,22 @@ def handler(req):
write_var
(
req
,
encrypted_assertion
,
'encrypted_assertion'
)
if
client
==
'perl'
:
cipher
=
Blowfish
.
new
(
key
,
Blowfish
.
MODE_CBC
,
iv
)
num_padding
=
ord
(
cipher
.
decrypt
(
encrypted_assertion
)[
-
1
])
header_length
=
0
cipher
=
Blowfish
.
new
(
key
,
Blowfish
.
MODE_CBC
,
iv
)
plaintext
=
cipher
.
decrypt
(
encrypted_assertion
)[:(
-
1
*
num_padding
)]
# we need to initialise cipher twice: once to get the
# amount of padding, and then to actually decrypt
if
encryption_algorithm
==
'Blowfish'
:
cipher
=
Blowfish
.
new
(
key
,
Blowfish
.
MODE_CBC
,
iv
)
num_padding
=
ord
(
cipher
.
decrypt
(
encrypted_assertion
)[
-
1
])
cipher
=
Blowfish
.
new
(
key
,
Blowfish
.
MODE_CBC
,
iv
)
plaintext
=
cipher
.
decrypt
(
encrypted_assertion
)[:(
-
1
*
num_padding
)]
if
encryption_algorithm
==
'AES'
:
cipher
=
AES
.
new
(
key
,
AES
.
MODE_CBC
,
iv
)
num_padding
=
ord
(
cipher
.
decrypt
(
encrypted_assertion
)[
-
1
])
cipher
=
AES
.
new
(
key
,
AES
.
MODE_CBC
,
iv
)
plaintext
=
cipher
.
decrypt
(
encrypted_assertion
)[:(
-
1
*
num_padding
)]
if
client
==
'javascript'
:
iv
=
'asdasdff'
num_padding
=
8
header_length
=
0
#key = 'this';
key
=
base64
.
decode
cipher
=
Blowfish
.
new
(
key
,
Blowfish
.
MODE_CBC
,
iv
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment