source: TI12-security/trunk/python/Tests/m2Crypto/test_encryption.py @ 4082

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/Tests/m2Crypto/test_encryption.py@4082
Revision 4082, 340 bytes checked in by pjkersha, 12 years ago (diff)

Further cleaning up of OpenID Provider code - TODO: AuthKit? and templating (if any) integration

  • Property svn:executable set to *
RevLine 
[4082]1#!/usr/bin/env python
2from M2Crypto import X509, RSA
3
4text = 'Hello world'
5x509Cert = X509.load_cert('./test.crt')
6rsaPubKey = x509Cert.get_pubkey().get_rsa()
7encrypted = rsaPubKey.public_encrypt(text, RSA.pkcs1_padding)
8
9priKey = RSA.load_key('./test.key')
10decrypted = priKey.private_decrypt(encrypted, RSA.pkcs1_padding)
11print decrypted
12
Note: See TracBrowser for help on using the repository browser.