Enhancement: Increment RSA key size to 2048.

It seems like many lead institutions related with security are
recommending a minimum key length of 112-bits since 2013.
In order to achieve that, a RSA key size of 2048 (or more) is required.
This commit is contained in:
Christian Bouvier 2018-10-05 11:55:35 -03:00
parent a7bbce3db2
commit 4c63cc67e0

View file

@ -1,6 +1,5 @@
from Cryptodome.PublicKey import RSA
from django.core.management.base import BaseCommand
from oidc_provider.models import RSAKey
@ -9,7 +8,7 @@ class Command(BaseCommand):
def handle(self, *args, **options):
try:
key = RSA.generate(1024)
key = RSA.generate(2048)
rsakey = RSAKey(key=key.exportKey('PEM').decode('utf8'))
rsakey.save()
self.stdout.write(u'RSA key successfully created with kid: {0}'.format(rsakey.kid))