django-instapush
django-instapush copied to clipboard
Change in apns certificate section headers
Hi,
I do not know if this library is still maintained as I see the last commit was three years ago.
Anyway, today I have noticed that in new apns certificates the header
-----BEGIN RSA PRIVATE KEY-----
has been substituted by
-----BEGIN PRIVATE KEY-----
and same for
-----END RSA PRIVATE KEY-----
with
-----END PRIVATE KEY-----
So I suggest to change the method _check_certificate in instapush/libs/apns to include this changes
def _check_certificate(ss):
mode = 'start'
for s in ss.split('\n'):
if mode == 'start':
if 'BEGIN RSA PRIVATE KEY' in s or 'BEGIN PRIVATE KEY' in s:
mode = 'key'
elif mode == 'key':
if 'END RSA PRIVATE KEY' in s or 'END PRIVATE KEY' in s:
mode = 'end'
break
elif s.startswith('Proc-Type') and 'ENCRYPTED' in s:
raise Exception("The certificate private key should not be encrypted")
if mode != 'end':
raise Exception("The certificate doesn't contain a private key")
Hope this can help.
Best regards, Luca