コード例 #1
0
    def _parsePublisher(self, raw_publisher_string):
        """Parses publisher string which is a certificate attributes string, e.g.

        CN=Microsoft Corporation, O=Microsoft Corporation,L=Redmond, S=Washington, C=US

        @return: Organization string
        """
        dn = DnParser().parse(raw_publisher_string)
        organization = dn.find_first("O")
        if organization:
            return organization.value
コード例 #2
0
    def _parsePublisher(self, raw_publisher_string):
        '''Parses publisher string which is a certificate attributes string, e.g.

        CN=Microsoft Corporation, O=Microsoft Corporation,L=Redmond, S=Washington, C=US

        @return: Organization string
        '''
        dn = DnParser().parse(raw_publisher_string)
        organization = dn.find_first('O')
        if organization:
            return organization.value
コード例 #3
0
 def parse(self, javaCert):
     '''
         Perform trasformation from java.security.X509Certificate to ssl_cert.X509Certificate
         @types: java.security.X509Certificate -> ssl_cert.X509Certificate
     '''
     typeCert = javaCert.getType()
     if typeCert == CertificateTypes.X509:
         objParser = DnParser()
         subject = javaCert.getSubjectDN().getName()
         issuedBy = javaCert.getIssuerDN().getName()
         subjectDn = objParser.parse(subject)
         issuedByDn = objParser.parse(issuedBy)
         version = javaCert.getVersion()
         create = javaCert.getNotBefore()
         expires = javaCert.getNotAfter()
         serialNumber = self.__bytesToHex(BigInteger(str(javaCert.getSerialNumber())).toByteArray())
         return X509Certificate(create, expires, LDAPDistinguishedObject(subjectDn, subject),
                                LDAPDistinguishedObject(issuedByDn, issuedBy),
                                serialNumber, javaCert.getSigAlgName(), typeCert, version)
     return None
コード例 #4
0
 def parse(self, javaCert):
     '''
         Perform trasformation from java.security.X509Certificate to ssl_cert.X509Certificate
         @types: java.security.X509Certificate -> ssl_cert.X509Certificate
     '''
     typeCert = javaCert.getType()
     if typeCert == CertificateTypes.X509:
         objParser = DnParser()
         subject = javaCert.getSubjectDN().getName()
         issuedBy = javaCert.getIssuerDN().getName()
         subjectDn = objParser.parse(subject)
         issuedByDn = objParser.parse(issuedBy)
         version = javaCert.getVersion()
         create = javaCert.getNotBefore()
         expires = javaCert.getNotAfter()
         serialNumber = self.__bytesToHex(
             BigInteger(str(javaCert.getSerialNumber())).toByteArray())
         return X509Certificate(
             create, expires, LDAPDistinguishedObject(subjectDn, subject),
             LDAPDistinguishedObject(issuedByDn, issuedBy), serialNumber,
             javaCert.getSigAlgName(), typeCert, version)
     return None