如何在 .mobileconfig
文件中插入 .p12
文件?
Apple 配置实用程序当前在将 .p12 文件插入 .mobileconfig
(它只是一个 XML 文件)时对它执行一些未知的转换/编码。
我想通过直接创建 XML 文件来创建此 .mobileconfig 文件,而不使用 Apple iPhone 配置实用程序。
谢谢
最佳答案
实现此目的的一种方法是对 PKCS#12 文件进行 base64 编码。例如,这适用于 PHP
openssl_pkcs12_export( $strCertPEM, $strCertPkcs12, $resKey, $strCertPW );
$arrCertBase64 = str_split( base64_encode($strCertPkcs12), 52);
$xmlUserCertPlist = plistVar('PayloadContent',$arrCertBase64,'data');
function plistVar($key,$var,$type)
{
//...snip...
if ( $type == 'data' ) return plistData($key,$var);
//...snip...
}
function plistData($key,$arr)
{
//...snip...
$xml = "<key>". $key ."</key>\n";
$xml .= "<data>\n";
foreach ($arr as $val) { $xml .= $val."\n"; }
$xml .= "</data>\n";
return $xml;
}
关于iphone - 将 pkcs12 插入到 mobileconfig 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9515153/