[root@localhost ~]# vim /root/newkeys/dbcertkey33.pl
foreach my $line (@encoded) {
$line =~ s/\n//g;
$new_line .= $line;
}
system "sed -i's/nsComment.*=.*/nsComment=\"CN=\\\\\"$new_line\\\\\"\"/g'openssl.cnf";
system "openssl req -new -newkey rsa:1024 -config'openssl.cnf' -out xxx$acc$end$fock$count.pem -subj\"/C=US/ST=California/L=Los Gatos/O=xxx, Inc./CN=\\\"xxxSCEP Server\\\"\" -keyout xxx$acc$end$fock$count\key.pem -nodes-batch;openssl x509 -req -in xxx$acc$end$fock$count.pem -CAkey cakey.pem-CA cacert.pem -extfile 'openssl.cnf' -extensions usr_cert -days 3652 -outxxx$acc$end$fock$count$cert.pem -CAcreateserial -CAserial serial";
[root@localhost ~]# vim /root/newkeys/dbcertkeyok.pl
#!/bin/perl
use MIME::Base64;
use strict;
my $end = 'end';
my $cert = 'cert';
for(my $acc =642; $acc <= 645; $acc++) {
for(my $fock =101; $fock <=300; $fock++) {
for(my $count =11; $count <= 60; $count++) {
my $BASE ="{'policyName': 'policy13316363844223bcd9f10', 'UDID':'86a58553d7e0456d10ba255057fd8216$acc$fock$count', 'checksum':'profile1331636384422b5bc3f8a', 'servicesFlag': '63', 'userID':'xxx$acc$end$fock$count\@xxx.com', 'profileM_mark': '2','displayType': 'iPad2', 'deviceType': 'iPad', 'profileN_name':'profile1331636384422b5bc3f8a', 'profileName': 'profile1331636384422b5bc3f8a','enduserType': 'hostedUser', 'accountID': '$acc'}";
my @encoded = encode_base64("$BASE");
my $new_line = '';
foreach my $line (@encoded) {
$line =~ s/\n//g;
$new_line .= $line;
}
system "sed -i's/nsComment.*=.*/nsComment=\"CN=\\\\\"$new_line\\\\\"\"/g'openssl.cnf";
system "openssl req -new -newkey rsa:1024 -config'openssl.cnf' -out xxx$acc$end$fock$count.pem -subj\"/C=US/ST=California/L=Los Gatos/O=xxx, Inc./CN=\\\"xxxSCEP Server\\\"\" -keyout xxx$acc$end$fock$count\key.pem -nodes-batch;openssl x509 -req -in xxx$acc$end$fock$count.pem -CAkey cakey.pem-CA cacert.pem -extfile 'openssl.cnf' -extensions usr_cert -days 3652 -out xxx$acc$end$fock$count$cert.pem-CAcreateserial -CAserial serial";
}
}
}