mirror of
https://seed.flo-the.dev/z3gWc1qgaeZaoGwL4WTstLNoqjayM.git
synced 2025-12-06 04:47:35 +01:00
use aes_256 instead of des
Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
This commit is contained in:
@@ -172,13 +172,7 @@ class SMTPClient(SMTP):
|
||||
Returns:
|
||||
bytes: Encrypted message
|
||||
"""
|
||||
# Make a MemoryBuffer of the message.
|
||||
buf = BIO.MemoryBuffer(message)
|
||||
|
||||
# Seed the PRNG.
|
||||
# Rand.load_file('randpool.dat', -1)
|
||||
|
||||
# Instantiate an SMIME object.
|
||||
s = SMIME.SMIME()
|
||||
|
||||
# Load target cert to encrypt to.
|
||||
@@ -187,9 +181,7 @@ class SMTPClient(SMTP):
|
||||
sk.push(x509)
|
||||
s.set_x509_stack(sk)
|
||||
|
||||
# Set cipher: 3-key triple-DES in CBC mode.
|
||||
# TODO: Evaluate later
|
||||
s.set_cipher(SMIME.Cipher("des_ede3_cbc"))
|
||||
s.set_cipher(SMIME.Cipher("aes_256_cbc"))
|
||||
|
||||
# Encrypt the buffer.
|
||||
p7 = s.encrypt(buf)
|
||||
@@ -197,16 +189,12 @@ class SMTPClient(SMTP):
|
||||
# Output p7 in mail-friendly format.
|
||||
out = BIO.MemoryBuffer()
|
||||
|
||||
# Add header
|
||||
out.write("From: " + self._config.sender + "\r\n")
|
||||
out.write("To: " + ", ".join(self._config.recipients) + "\r\n")
|
||||
out.write("Subject: " + subject + "\r\n")
|
||||
s.write(out, p7)
|
||||
|
||||
# print(out.read().decode())
|
||||
|
||||
# Save the PRNG's state.
|
||||
# Rand.save_file('randpool.dat')
|
||||
|
||||
return out.read()
|
||||
|
||||
def _sign(self, message: Message) -> bytes:
|
||||
|
||||
Reference in New Issue
Block a user