好友
阅读权限25
听众
最后登录1970-1-1
|
ppgjx
发表于 2022-4-13 23:06
#!/usr/bin/ruby -w
# -*- coding: UTF-8 -*-
require 'openssl'
passcode_payload ={
'PayloadUUID' => 'RANDOM_STRING_UUID',
'PayloadOrganization' => 'PayloadOrganization',
'PayloadVersion' => 1,
'PayloadIdentifier' => 'com.test.PayloadIdentifier',
'PayloadType' => 'Configuration',
'PayloadDisplayName' => 'PayloadDisplayName',
'PayloadRemovalDisallowed' => false
}
passcode_payload_content = {
'PayloadDescription' => 'PayloadDescription',
'PayloadDisplayName' => 'PayloadDisplayName',
'PayloadIdentifier' => 'PayloadIdentifier',
'PayloadOrganization' => 'PayloadOrganization',
'PayloadType' => 'com.apple.mobiledevice.passwordpolicy',
'PayloadUUID' => "RANDOM_STRING_UUID",
'PayloadVersion' => 1,
'allowSimple' => true,
'forcePIN' => true,
'maxPINAgeInDays' => 20,
'minComplexChars' => 1,
'minLength' => 4,
'requireAlphanumeric' => true
}
passcode_payload_content_array = [passcode_payload_content]
puts passcode_payload_content_array
to_be_encrypted_plist = passcode_payload_content_array.to_plist
device_certificate = OpenSSL::X509::Certificate.new File.read('1.pem')
encrypted_payload = OpenSSL::PKCS7.encrypt([device_certificate],to_be_encrypted_plist, OpenSSL::Cipher::Cipher::new("des-ede3-cbc"),OpenSSL::PKCS7::BINARY)
passcode_payload['EncryptedPayloadContent'] = StringIO.new(encrypted_payload.to_der)
他提示在这passcode_payload_content_array.to_plist to_plist 方法不存在怎么办呢?
|
|
发帖前要善用【论坛搜索】功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。 |
|
|
|
|