RFC822Name is a general name type that you'd use within a
SubjectAlternativeName. Chances are in this case you actually want the
email in the subjectDN, right? If so then you just want to add another
element to the list you pass to x509.Name:

x509.NameAttribute(NameOID.EMAIL_ADDRESS, email_address)

-Paul Kehrer (reaperhulk)

On July 5, 2017 at 10:36:08 AM, Karan karan (karan7...@gmail.com) wrote:

Hi,

I'm trying to set the email on the certificate my code below , since its a
self signed so the issuer and the subject are same:

email = 'ad...@example.com'
subject = issuer = x509.Name([x509.NameAttribute(NameOID.COUNTRY_NAME,
country_name),
        x509.NameAttribute(NameOID.STATE_OR_PROVINCE_NAME, state_name),
        x509.NameAttribute(NameOID.LOCALITY_NAME, locality_name),
        x509.NameAttribute(NameOID.ORGANIZATION_NAME, org_name),
        x509.NameAttribute(NameOID.COMMON_NAME, common_name)
        ])
      *x509.RFC822Name(email)*

When i check the certificate details i don't see the email id being set
using s_client connect

Thanks,
Karan.
_______________________________________________
Cryptography-dev mailing list
Cryptography-dev@python.org
https://mail.python.org/mailman/listinfo/cryptography-dev
_______________________________________________
Cryptography-dev mailing list
Cryptography-dev@python.org
https://mail.python.org/mailman/listinfo/cryptography-dev

Reply via email to