2017-02-13 460 views
2

A XIP file is an analog to zip, but allows for a digital signature to be applied and verified on the receiving system, before the archive is expanded. When a XIP file is opened (by double-clicking), Archive Utility will automatically expand it (but only if the digital signature is intact).将.xip文件解压缩到特定文件夹

基本上,.xip文件只是一个带签名的.zip文件,用于验证文件自创建者保存后未发生更改。这可以防止磁盘错误和第三方篡改文件造成的损害。

有谁知道,如何提取该文件,例如使用终端,到一个特定的文件夹而不是到.xip文件所在的文件夹?

+0

如果是“只是一个zip”,那么想必普通的解压缩工具将做的伎俩。或者你想验证签名吗? – halfer

回答

0

我会建议简单的提取归档到该文件夹​​,你想尝试以下操作:

xar -xf file.xip -C /path/to/target 

(和/或)

tar -zxvf file.xip -C /path/to/target 

xartar命令提取.xip“内容“和”元数据“以原始格式。

使用使用pbzx流解析器,你需要提取“内容”,这是一个LZMA压缩的有效载荷;格式与包安装程序中的格式类似(例如.pkg)。

pbzx -n Content | cpio -i 

您可以compile the pbzx source from here,或download the compiled binary并安装到/usr/local/bin然后调用pbzx命令。在命令完成解析内容之后,您应该获得.xip存档内的任何内容的原始形式。

有用/附加信息

$ pkgutil --check-signature file.xip 

Xcode_9_beta_2.xip返回:

Package "Xcode_9_beta_2.xip": 
    Status: signed Apple Software 
    Certificate Chain: 
    1. Software Update 
     SHA1 fingerprint: 1E 34 E3 91 C6 44 37 DD 24 BE 57 B1 66 7B 2F DA 09 76 E1 FD 
     ----------------------------------------------------------------------------- 
    2. Apple Software Update Certification Authority 
     SHA1 fingerprint: FA 02 79 0F CE 9D 93 00 89 C8 C2 51 0B BC 50 B4 85 8E 6F BF 
     ----------------------------------------------------------------------------- 
    3. Apple Root CA 
     SHA1 fingerprint: 61 1E 5B 66 2C 59 3A 08 FF 58 D1 4A E2 24 52 D1 98 DF 6C 60 

Important: Starting with macOS Sierra, only XIP archives signed by Apple will be expanded. Developers who have been using XIP archives will need to move to using signed installer packages or disk images.

OS X manual page : xip

+0

我得到一个错误: 'Archive:Xcode_8.1.xip 找不到中央目录结尾的签名。这个文件不是一个zip文件,或者它构成一个多部分档案的一个磁盘。在后一种情况下,中心目录和zipfile注释将在此存档的最后一个磁盘上找到。注意:Xcode_8.1.xip可能是一个简单的可执行文件,而不是一个归档文件' –

+0

当你双击文件时会发生什么? –

+0

它打开默认的**归档工具**来验证签名和提取。但是,在完成验证错误出现之前。 –

0

您可以打开归档工具本身,进入设置,并设置一个特定的目标文件夹,然后双击该文件。这样你就可以将它扩展到一个特定的目的地。 ;-)