[python] M2Crypto를 이용하여 파일을 복호화하는 방법은 어떻게 되나요?
  1. 먼저, M2Crypto 라이브러리를 설치합니다.
pip install M2Crypto
  1. 다음은 예제 코드입니다.
from M2Crypto import BIO, RSA, SMIME

# 개인키 및 인증서 파일 경로
private_key_file = 'private_key.pem'
certificate_file = 'certificate.pem'

# 복호화할 파일 경로
encrypted_file = 'encrypted_file.bin'
decrypted_file = 'decrypted_file.txt'

# 개인키 및 인증서 불러오기
private_key = RSA.load_key(private_key_file)
certificate = X509.X509()
certificate.load_cert(certificate_file)

# SMIME 오브젝트 생성
smime = SMIME.SMIME()

# 복호화 수행
in_buf = BIO.File(encrypted_file)
out_buf = BIO.File(decrypted_file, 'w')
smime.p7_decrypt(in_buf, private_key, certificate, out_buf)

위의 코드는 M2Crypto를 사용하여 파일을 복호화하는 간단한 예제입니다. 위 코드를 참고하여 원하는 방식으로 파일을 복호화할 수 있습니다.