apple-codesign 0.29.0

Pure Rust interface to code signing on Apple platforms
Documentation
Sign a bundle with symlinks in a nested directory

```
$ rcodesign debug-create-macho MyApp.app/Contents/MacOS/MyApp
assuming default minimum version 11.0.0
writing Mach-O to MyApp.app/Contents/MacOS/MyApp

$ rcodesign debug-create-info-plist --bundle-name MyApp MyApp.app/Contents/Info.plist
writing MyApp.app/Contents/Info.plist

$ rcodesign debug-create-macho --file-type dylib MyApp.app/Contents/Frameworks/libssh.4.8.8.dylib
assuming default minimum version 11.0.0
writing Mach-O to MyApp.app/Contents/Frameworks/libssh.4.8.8.dylib

$ ln -s libssh.4.8.8.dylib MyApp.app/Contents/Frameworks/libssh.4.dylib
$ ln -s libssh.4.dylib MyApp.app/Contents/Frameworks/libssh.dylib

$ rcodesign sign MyApp.app MyApp.app.signed
signing MyApp.app to MyApp.app.signed
signing bundle at MyApp.app
signing bundle at MyApp.app into MyApp.app.signed
signing Mach-O file Contents/Frameworks/libssh.4.8.8.dylib
signing main executable Contents/MacOS/MyApp

$ rcodesign debug-file-tree MyApp.app.signed
d                      MyApp.app.signed/
d                      MyApp.app.signed/Contents
d                      MyApp.app.signed/Contents/Frameworks
f 40a8b05ac0eac09b1186 MyApp.app.signed/Contents/Frameworks/libssh.4.8.8.dylib
l                      MyApp.app.signed/Contents/Frameworks/libssh.4.dylib -> libssh.4.8.8.dylib
l                      MyApp.app.signed/Contents/Frameworks/libssh.dylib -> libssh.4.dylib
f 0a5902dc8e47f490d038 MyApp.app.signed/Contents/Info.plist
d                      MyApp.app.signed/Contents/MacOS
f 8f330392b30c9cbd593d MyApp.app.signed/Contents/MacOS/MyApp
d                      MyApp.app.signed/Contents/_CodeSignature
f 273cd2b4970deda577c2 MyApp.app.signed/Contents/_CodeSignature/CodeResources

$ rcodesign print-signature-info MyApp.app.signed
- path: Contents/Frameworks/libssh.4.8.8.dylib
  file_size: 22544
  file_sha256: 40a8b05ac0eac09b118678fb3cadd62a364b5b40c0a04db953b9924d891fc3ef
  entity:
    mach_o:
      macho_linkedit_start_offset: 16384 / 0x4000
      macho_signature_start_offset: 16400 / 0x4010
      macho_signature_end_offset: 16777 / 0x4189
      macho_linkedit_end_offset: 22544 / 0x5810
      macho_end_offset: 22544 / 0x5810
      linkedit_signature_start_offset: 16 / 0x10
      linkedit_signature_end_offset: 393 / 0x189
      linkedit_bytes_after_signature: 5767 / 0x1687
      signature:
        superblob_length: 377 / 0x179
        blob_count: 3
        blobs:
        - slot: CodeDirectory (0)
          magic: fade0c02
          length: 321
          sha1: 5b19ce6b4bcd9ad15044c2066216829d95ea7ab0
          sha256: 870a3508181d52e36783c1bf86010a76ad8f735165f2440f23a7c42119b4be9f
        - slot: RequirementSet (2)
          magic: fade0c01
          length: 12
          sha1: 3a75f6db058529148e14dd7ea1b4729cc09ec973
          sha256: 987920904eab650e75788c054aa0b0524e6a80bfc71aa32df8d237a61743f986
        - slot: CMS Signature (65536)
          magic: fade0b01
          length: 8
          sha1: 2a7254313aa41796079bb0e9d0f044345f69f98b
          sha256: e6c83bc98a10348492c7d4d2378a54572ef29e1a5692ccd02b5e29f4b762d6a0
        code_directory:
          version: '0x20400'
          flags: CodeSignatureFlags(ADHOC)
          identifier: libssh.4
          digest_type: sha256
          platform: 0
          signed_entity_size: 16400
          executable_segment_flags: ExecutableSegmentFlags(0x0)
          code_digests_count: 5
          slot_digests:
          - 'Info (1): 0000000000000000000000000000000000000000000000000000000000000000'
          - 'RequirementSet (2): 987920904eab650e75788c054aa0b0524e6a80bfc71aa32df8d237a61743f986'
        cms: null
- path: Contents/Frameworks/libssh.4.dylib
  symlink_target: libssh.4.8.8.dylib
  entity: other
- path: Contents/Frameworks/libssh.dylib
  symlink_target: libssh.4.dylib
  entity: other
- path: Contents/Info.plist
  file_size: 576
  file_sha256: 0a5902dc8e47f490d03889d3593d17bddbf79e6c1f79494e20dd28f9459effa5
  entity: other
- path: Contents/MacOS/MyApp
  file_size: 22544
  file_sha256: 8f330392b30c9cbd593dc332979a2a2dfcc3edfe1b3bcfd1c5e2fecb31aeca00
  entity:
    mach_o:
      macho_linkedit_start_offset: 16384 / 0x4000
      macho_signature_start_offset: 16400 / 0x4010
      macho_signature_end_offset: 16821 / 0x41b5
      macho_linkedit_end_offset: 22544 / 0x5810
      macho_end_offset: 22544 / 0x5810
      linkedit_signature_start_offset: 16 / 0x10
      linkedit_signature_end_offset: 437 / 0x1b5
      linkedit_bytes_after_signature: 5723 / 0x165b
      signature:
        superblob_length: 421 / 0x1a5
        blob_count: 3
        blobs:
        - slot: CodeDirectory (0)
          magic: fade0c02
          length: 365
          sha1: 98f382966f6efe2b3158f862123c12c57dc167a9
          sha256: b7256b5560a1bc8c7f1e3f56d1eabc9ed248e4b97fee8e716efd5909681f95be
        - slot: RequirementSet (2)
          magic: fade0c01
          length: 12
          sha1: 3a75f6db058529148e14dd7ea1b4729cc09ec973
          sha256: 987920904eab650e75788c054aa0b0524e6a80bfc71aa32df8d237a61743f986
        - slot: CMS Signature (65536)
          magic: fade0b01
          length: 8
          sha1: 2a7254313aa41796079bb0e9d0f044345f69f98b
          sha256: e6c83bc98a10348492c7d4d2378a54572ef29e1a5692ccd02b5e29f4b762d6a0
        code_directory:
          version: '0x20400'
          flags: CodeSignatureFlags(ADHOC)
          identifier: com.example.mybundle
          digest_type: sha256
          platform: 0
          signed_entity_size: 16400
          executable_segment_flags: ExecutableSegmentFlags(MAIN_BINARY)
          code_digests_count: 5
          slot_digests:
          - 'Info (1): 0a5902dc8e47f490d03889d3593d17bddbf79e6c1f79494e20dd28f9459effa5'
          - 'RequirementSet (2): 987920904eab650e75788c054aa0b0524e6a80bfc71aa32df8d237a61743f986'
          - 'Resources (3): 273cd2b4970deda577c29fcd05055752e46144fe483371d48754d273bbccbb85'
        cms: null
- path: Contents/_CodeSignature/CodeResources
  file_size: 2673
  file_sha256: 273cd2b4970deda577c29fcd05055752e46144fe483371d48754d273bbccbb85
  entity:
    bundle_code_signature_file: !ResourcesXml
    - <?xml version="1.0" encoding="UTF-8"?>
    - <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    - <plist version="1.0">
    - <dict>
    - '  <key>files</key>'
    - '  <dict/>'
    - '  <key>files2</key>'
    - '  <dict>'
    - '    <key>Frameworks/libssh.4.8.8.dylib</key>'
    - '    <dict>'
    - '      <key>cdhash</key>'
    - '      <data>'
    - '      hwo1CBgdUuNng8G/hgEKdq2Pc1E='
    - '      </data>'
    - '      <key>requirement</key>'
    - '      <string>cdhash H"870a3508181d52e36783c1bf86010a76ad8f7351"</string>'
    - '    </dict>'
    - '    <key>Frameworks/libssh.4.dylib</key>'
    - '    <dict>'
    - '      <key>symlink</key>'
    - '      <string>libssh.4.8.8.dylib</string>'
    - '    </dict>'
    - '    <key>Frameworks/libssh.dylib</key>'
    - '    <dict>'
    - '      <key>symlink</key>'
    - '      <string>libssh.4.dylib</string>'
    - '    </dict>'
    - '  </dict>'
    - '  <key>rules</key>'
    - '  <dict>'
    - '    <key>^Resources/</key>'
    - '    <true/>'
    - '    <key>^Resources/.*/.lproj/</key>'
    - '    <dict>'
    - '      <key>optional</key>'
    - '      <true/>'
    - '      <key>weight</key>'
    - '      <real>1000</real>'
    - '    </dict>'
    - '    <key>^Resources/.*/.lproj/locversion.plist$</key>'
    - '    <dict>'
    - '      <key>omit</key>'
    - '      <true/>'
    - '      <key>weight</key>'
    - '      <real>1100</real>'
    - '    </dict>'
    - '    <key>^Resources/Base/.lproj/</key>'
    - '    <dict>'
    - '      <key>weight</key>'
    - '      <real>1010</real>'
    - '    </dict>'
    - '    <key>^version.plist$</key>'
    - '    <true/>'
    - '  </dict>'
    - '  <key>rules2</key>'
    - '  <dict>'
    - '    <key>.*/.dSYM($|/)</key>'
    - '    <dict>'
    - '      <key>weight</key>'
    - '      <real>11</real>'
    - '    </dict>'
    - '    <key>^(.*/)?/.DS_Store$</key>'
    - '    <dict>'
    - '      <key>omit</key>'
    - '      <true/>'
    - '      <key>weight</key>'
    - '      <real>2000</real>'
    - '    </dict>'
    - '    <key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>'
    - '    <dict>'
    - '      <key>nested</key>'
    - '      <true/>'
    - '      <key>weight</key>'
    - '      <real>10</real>'
    - '    </dict>'
    - '    <key>^.*</key>'
    - '    <true/>'
    - '    <key>^Info/.plist$</key>'
    - '    <dict>'
    - '      <key>omit</key>'
    - '      <true/>'
    - '      <key>weight</key>'
    - '      <real>20</real>'
    - '    </dict>'
    - '    <key>^PkgInfo$</key>'
    - '    <dict>'
    - '      <key>omit</key>'
    - '      <true/>'
    - '      <key>weight</key>'
    - '      <real>20</real>'
    - '    </dict>'
    - '    <key>^Resources/</key>'
    - '    <dict>'
    - '      <key>weight</key>'
    - '      <real>20</real>'
    - '    </dict>'
    - '    <key>^Resources/.*/.lproj/</key>'
    - '    <dict>'
    - '      <key>optional</key>'
    - '      <true/>'
    - '      <key>weight</key>'
    - '      <real>1000</real>'
    - '    </dict>'
    - '    <key>^Resources/.*/.lproj/locversion.plist$</key>'
    - '    <dict>'
    - '      <key>omit</key>'
    - '      <true/>'
    - '      <key>weight</key>'
    - '      <real>1100</real>'
    - '    </dict>'
    - '    <key>^Resources/Base/.lproj/</key>'
    - '    <dict>'
    - '      <key>weight</key>'
    - '      <real>1010</real>'
    - '    </dict>'
    - '    <key>^[^/]+$</key>'
    - '    <dict>'
    - '      <key>nested</key>'
    - '      <true/>'
    - '      <key>weight</key>'
    - '      <real>10</real>'
    - '    </dict>'
    - '    <key>^embedded/.provisionprofile$</key>'
    - '    <dict>'
    - '      <key>weight</key>'
    - '      <real>20</real>'
    - '    </dict>'
    - '    <key>^version/.plist$</key>'
    - '    <dict>'
    - '      <key>weight</key>'
    - '      <real>20</real>'
    - '    </dict>'
    - '  </dict>'
    - </dict>
    - </plist>
    - ''

```