File Coverage

blib/lib/Config/Apple/Profile/Payload/Certificate/Root.pm
Criterion Covered Total %
statement 24 24 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod n/a
total 32 32 100.0


line stmt bran cond sub pod time code
1             # This is the code for Config::Apple::Profile::Payload::Certificate::Root.
2             # For Copyright, please see the bottom of the file.
3              
4             package Config::Apple::Profile::Payload::Certificate::Root;
5              
6 1     1   1311 use 5.14.4;
  1         3  
  1         44  
7 1     1   6 use strict;
  1         3  
  1         34  
8 1     1   7 use warnings FATAL => 'all';
  1         2  
  1         37  
9 1     1   4 use base qw(Config::Apple::Profile::Payload::Certificate);
  1         2  
  1         94  
10              
11             our $VERSION = '0.55';
12              
13 1     1   5 use Readonly;
  1         2  
  1         66  
14 1     1   4 use Config::Apple::Profile::Targets qw(:all);
  1         3  
  1         137  
15 1     1   6 use Config::Apple::Profile::Payload::Certificate;
  1         2  
  1         24  
16 1     1   5 use Config::Apple::Profile::Payload::Types qw($ProfileNumber $ProfileString);
  1         2  
  1         229  
17              
18              
19             =encoding utf8
20              
21             =head1 NAME
22              
23             Config::Apple::Profile::Payload::Certificate::Root - Certificate payload with
24             a DER-format certificate.
25              
26             =head1 SYNOPSIS
27              
28             use Config::Apple::Profile;
29             use Config::Apple::Profile::Payload::Certificate::Root;
30            
31             my $cert = new Config::Apple::Profile::Payload::Certificate::Root;
32             $cert->payload->{PayloadIdentifier} = 'local.acme.CAcert';
33             $cert->payload->{PayloadDisplayName} = 'AcmeCorp internal CA';
34             $cert->payload->{PayloadDescription} = 'The certificate authority used for internal web sites.';
35             $cert->payload->{PayloadOrganization} = 'Acme, Inc.';
36             $cert->payload->{PayloadCertificateFileName} = 'acme.crt';
37             $cert->payload->{PayloadContent} = '.............'; # Long binary data here
38            
39             my $profile = new Config::Apple::Profile::Profile;
40             push @{$profile->content}, $cert;
41            
42             print $profile->export;
43            
44             =head1 DESCRIPTION
45              
46             This class implements the root type of Certificate payload.
47              
48             This payload contains a single certificate, in a PKCS#1 container,
49             DER-encoded. For reference, pretty much any certificate you get, when you are
50             just getting a certificate, will be in a PKCS#1 container. DER encoding is a
51             binary encoding, it's not the "BEGIN CERTIFICATE" type of encoding (that's PEM).
52              
53             This payload is used to hold B certificate. If you have multiple
54             certificates, use multiple payloads.
55              
56             B This type is exactly the same as the C type of Certificate
57             payload.
58              
59              
60             =head1 PAYLOAD KEYS
61              
62             All of the payload keys defined in
63             L are used by this
64             payload.
65              
66             This payload has the following additional keys:
67              
68             =head2 C
69              
70             This is fixed to the string C.
71              
72             =head2 C
73              
74             This is fixed to the value C<1>.
75              
76             =cut
77              
78             Readonly our %payloadKeys => (
79             # Bring in the certificate keys...
80             %Config::Apple::Profile::Payload::Certificate::payloadKeys,
81            
82             # Since we can't go any deeper, define the type and version!
83             'PayloadType' => {
84             type => $ProfileString,
85             targets => {
86             $TargetIOS => '5.0',
87             $TargetMACOSX => '10.7',
88             },
89             value => 'com.apple.security.root',
90             },
91             'PayloadVersion' => {
92             type => $ProfileNumber,
93             targets => {
94             $TargetIOS => '5.0',
95             $TargetMACOSX => '10.7',
96             },
97             value => 1,
98             },
99             ); # End of %payloadKeys
100              
101              
102              
103             =head1 ACKNOWLEDGEMENTS
104              
105             Refer to L for acknowledgements.
106              
107             =head1 AUTHOR
108              
109             A. Karl Kornel, C<< >>
110              
111             =head1 COPYRIGHT AND LICENSE
112              
113             Copyright © 2014 A. Karl Kornel.
114              
115             This program is free software; you can redistribute it and/or modify it
116             under the terms of either: the GNU General Public License as published
117             by the Free Software Foundation; or the Artistic License.
118              
119             See L for more information.
120              
121             =cut
122              
123             1;