Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
prv = key_class.generate(bits=2048)
import six
prv_bio = six.BytesIO()
prv.write_private_key(prv_bio)
prv_bio_read = six.BytesIO(prv_bio.getvalue())
pub = key_class.from_private_key(prv_bio_read)
pub_bio = six.BytesIO()
pub_bio.write("%s %s relate-course-key" % (pub.get_name(), pub.get_base64()))
return render(request, "course/keypair.html", {
"public_key": prv_bio.getvalue().decode(),
"private_key": pub_bio.getvalue().decode(),
})
# }}}