original_docstring: Abstracted method covering the enrollment procedure.
          Returns tar file contents or None.
docstring: Abstracted method covering the enrollment procedure.
  Returns tar file contents or None.
docstring_tokens: Abstracted method covering the enrollment procedure . Returns tar file contents or None .
code: def do_enrollment(given_serial):
      '''Abstracted method covering the enrollment procedure.
          Returns tar file contents or None.'''
      # Validate serial:
      given_serial = devices.validate_serial_number(given_serial)
      if not given_serial:
          common.logging_error("Serial number failed validation.")
          return None
      # Generate manifest:
      manifests.make_computer_manifest(given_serial)
      # Create private key:
      client_key = security.generate_private_key()
      # Create CSR:
      client_csr = security.generate_csr(client_key,given_serial)
      # Read CA certificate:
      ca_cert = security.read_ca_cert()
      ca_cert_p12_data = security.make_p12_with_ca_cert(ca_cert,given_serial)
      ca_cert_cn = security.read_cert_cn(ca_cert)
      # Sign CSR:
      client_cert = security.sign_with_ca(client_csr,ca_cert)
      # Generate mobileconfig:
      mobileconfig_contents = make_mobileconfig(given_serial,ca_cert_p12_data,ca_cert_cn)
      if not mobileconfig_contents:
          common.logging_error("Failed to generate mobileconfig_contents.")
          return None
      # Generate identity PEM (client key + client cert + CA cert):
      pki_contents = security.make_identity_pem_string(client_key,client_cert,ca_cert)
      if not pki_contents:
          common.logging_error("Failed to generate pki_contents.")
          return None
      # Return tar file:
      return make_tar_file(given_serial,pki_contents,mobileconfig_contents)
code_tokens: def do_enrollment ( given_serial ) : given_serial = devices . validate_serial_number ( given_serial ) if not given_serial : common . logging_error ( "Serial number failed validation." ) return None manifests . make_computer_manifest ( given_serial ) client_key = security . generate_private_key ( ) client_csr = security . generate_csr ( client_key , given_serial ) ca_cert = security . read_ca_cert ( ) ca_cert_p12_data = security . make_p12_with_ca_cert ( ca_cert , given_serial ) ca_cert_cn = security . read_cert_cn ( ca_cert ) client_cert = security . sign_with_ca ( client_csr , ca_cert ) mobileconfig_contents = make_mobileconfig ( given_serial , ca_cert_p12_data , ca_cert_cn ) if not mobileconfig_contents : common . logging_error ( "Failed to generate mobileconfig_contents." ) return None pki_contents = security . make_identity_pem_string ( client_key , client_cert , ca_cert ) if not pki_contents : common . logging_error ( "Failed to generate pki_contents." ) return None return make_tar_file ( given_serial , pki_contents , mobileconfig_contents )
short_docstring: Abstracted method covering the enrollment procedure.
short_docstring_tokens: Abstracted method covering the enrollment procedure .
comment: '''Abstracted method covering the enrollment procedure.
          Returns tar file contents or None.'''$SEP$# Validate serial:$SEP$# Generate manifest:$SEP$# Create private key:$SEP$# Create CSR:$SEP$# Read CA certificate:$SEP$# Sign CSR:$SEP$# Generate mobileconfig:$SEP$# Generate identity PEM (client key + client cert + CA cert):$SEP$# Return tar file: