Ejemplo n.º 1
0
    def __init__(self,
                 signer,
                 signer_cert_file=None,
                 apple_cert_file=None,
                 team_id=None):
        """ signer: an initialized Signer module
            signer_cert_file = your org's cert .pem
            apple_cert_file = apple certs in .pem form
            team_id = your Apple Organizational Unit code """

        log.debug('Signing with signer: {}'.format(signer.__class__.__name__))
        log.debug('Signing with certificate: {}'.format(signer_cert_file))

        # This should have been initialized by our caller
        self.signer = signer

        # these arguments are paths to files, and are required
        for filename in [signer_cert_file, apple_cert_file]:
            if not os.path.exists(filename):
                msg = "Can't find {0}".format(filename)
                log.warn(msg)
                raise MissingCredentials(msg)

        self.signer_cert_file = signer_cert_file
        self.apple_cert_file = apple_cert_file

        self._team_id = team_id  # This may be None, in which case
        # get_team_id() will try to pull it
        # from the signer cert.
        if self.get_team_id() is None:
            raise ImproperCredentials("Cert file does not contain Subject line"
                                      "with Apple Organizational Unit (OU)")

        OpenSslShell.check_version()
Ejemplo n.º 2
0
 def __init__(self,
              signer_key_file=None,
              signer_cert_file=None,
              apple_cert_file=None,
              team_id=None):
     """ signer_key_file = your org's key .pem
         signer_cert_file = your org's cert .pem
         apple_cert_file = apple certs in .pem form
         team_id = your Apple Organizational Unit code """
     for filename in [signer_key_file, signer_cert_file, apple_cert_file]:
         if not os.path.exists(filename):
             msg = "Can't find {0}".format(filename)
             log.warn(msg)
             raise MissingCredentials(msg)
     self.signer_key_file = signer_key_file
     self.signer_cert_file = signer_cert_file
     self.apple_cert_file = apple_cert_file
     team_id = self._get_team_id()
     if team_id is None:
         raise ImproperCredentials("Cert file does not contain Subject line"
                                   "with Apple Organizational Unit (OU)")
     self.team_id = team_id
     self.check_openssl_version()