line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# This is the code for Config::Apple::Profile::Payload::Certificate::PKCS12. |
2
|
|
|
|
|
|
|
# For Copyright, please see the bottom of the file. |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Config::Apple::Profile::Payload::Certificate::PKCS12; |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
1256
|
use 5.10.1; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
69
|
|
7
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
52
|
|
8
|
2
|
|
|
2
|
|
9
|
use warnings FATAL => 'all'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
55
|
|
9
|
2
|
|
|
2
|
|
8
|
use base qw(Config::Apple::Profile::Payload::Certificate); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
169
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.87.1'; |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
10
|
use Readonly; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
100
|
|
14
|
2
|
|
|
2
|
|
9
|
use Config::Apple::Profile::Targets qw(:all); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
252
|
|
15
|
2
|
|
|
2
|
|
14
|
use Config::Apple::Profile::Payload::Certificate; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
64
|
|
16
|
2
|
|
|
2
|
|
11
|
use Config::Apple::Profile::Payload::Types qw($ProfileNumber $ProfileString); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
345
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=encoding utf8 |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 NAME |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Config::Apple::Profile::Payload::Certificate::PKCS12 - Bundle containing |
24
|
|
|
|
|
|
|
one certificate and its matching private key. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SYNOPSIS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use Config::Apple::Profile; |
29
|
|
|
|
|
|
|
use Config::Apple::Profile::Payload::Certificate::PKCS12; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $cert = new Config::Apple::Profile::Payload::Certificate::PKCS12; |
32
|
|
|
|
|
|
|
$cert->payload->{PayloadIdentifier} = 'local.acme.key.user10'; |
33
|
|
|
|
|
|
|
$cert->payload->{PayloadDisplayName} = 'Private key & cert'; |
34
|
|
|
|
|
|
|
$cert->payload->{PayloadDescription} = 'The private key and certificate for employee #10'; |
35
|
|
|
|
|
|
|
$cert->payload->{PayloadOrganization} = 'Acme, Inc.'; |
36
|
|
|
|
|
|
|
$cert->payload->{PayloadCertificateFileName} = 'user10.p12'; |
37
|
|
|
|
|
|
|
$cert->payload->{Password} = 'Monkey123'; # DON'T DO THIS IN REAL LIFE!!! |
38
|
|
|
|
|
|
|
$cert->payload->{PayloadContent} = '.................'; # Binary data here |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $profile = new Config::Apple::Profile; |
41
|
|
|
|
|
|
|
push @{$profile->content}, $cert; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
print $profile->export; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 DESCRIPTION |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
This class implements the PKCS12 type of Certificate payload. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This payload contains a single certificate, and the certificate's private key, |
51
|
|
|
|
|
|
|
in a PKCS#12 container. The container is encrypted with a password. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This payload is used to hold B certificate. If you have any |
54
|
|
|
|
|
|
|
intermediate certificates, you will need to use a second Certificate payload |
55
|
|
|
|
|
|
|
(either a PEM or a PKCS1) to hold each intermediate certificate. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 PAYLOAD KEYS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
All of the payload keys defined in |
61
|
|
|
|
|
|
|
L are used by this |
62
|
|
|
|
|
|
|
payload. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This payload has the following additional keys: |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 C |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This is the password needed to decrypt the PKCS#12 file. If no password is |
69
|
|
|
|
|
|
|
provided, the user will be prompted to enter the password when installing the |
70
|
|
|
|
|
|
|
profile. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
B iOS 7 and 8 seem to have problems with identity certificates that do |
73
|
|
|
|
|
|
|
not have the C key in the payload. More information, and status, |
74
|
|
|
|
|
|
|
are in L. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 C |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This is fixed to the string C. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 C |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This is fixed to the value C<1>. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Readonly our %payloadKeys => ( |
87
|
|
|
|
|
|
|
# Bring in the certificate keys... |
88
|
|
|
|
|
|
|
%Config::Apple::Profile::Payload::Certificate::payloadKeys, |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# ... and define our own! |
91
|
|
|
|
|
|
|
'Password' => { |
92
|
|
|
|
|
|
|
type => $ProfileString, |
93
|
|
|
|
|
|
|
description => 'The password used to decrypt the file.', |
94
|
|
|
|
|
|
|
targets => { |
95
|
|
|
|
|
|
|
$TargetIOS => '5.0', |
96
|
|
|
|
|
|
|
$TargetMACOSX => '10.7', |
97
|
|
|
|
|
|
|
}, |
98
|
|
|
|
|
|
|
optional => 1, |
99
|
|
|
|
|
|
|
private => 1, |
100
|
|
|
|
|
|
|
}, |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# Since we can't go any deeper, define the type and version! |
103
|
|
|
|
|
|
|
'PayloadType' => { |
104
|
|
|
|
|
|
|
type => $ProfileString, |
105
|
|
|
|
|
|
|
targets => { |
106
|
|
|
|
|
|
|
$TargetIOS => '5.0', |
107
|
|
|
|
|
|
|
$TargetMACOSX => '10.7', |
108
|
|
|
|
|
|
|
}, |
109
|
|
|
|
|
|
|
value => 'com.apple.security.pkcs12', |
110
|
|
|
|
|
|
|
}, |
111
|
|
|
|
|
|
|
'PayloadVersion' => { |
112
|
|
|
|
|
|
|
type => $ProfileNumber, |
113
|
|
|
|
|
|
|
targets => { |
114
|
|
|
|
|
|
|
$TargetIOS => '5.0', |
115
|
|
|
|
|
|
|
$TargetMACOSX => '10.7', |
116
|
|
|
|
|
|
|
}, |
117
|
|
|
|
|
|
|
value => 1, |
118
|
|
|
|
|
|
|
}, |
119
|
|
|
|
|
|
|
); # End of %payloadKeys |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Refer to L for acknowledgements. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 AUTHOR |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
A. Karl Kornel, C<< >> |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Copyright © 2014 A. Karl Kornel. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
136
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
137
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
See L for more information. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
1; |