Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
inc-meta/build/remove_old_eduserv_cert.pl
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
45 lines (37 sloc)
1.03 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
# | |
# The input file is a fragment file that may or may not need to have | |
# the old Eduserv gateway certificate removed from it. Remove the certificate if | |
# required, or just re-export the file unchanged. | |
# | |
# This line indicates that the old certificate is present | |
# | |
# Ensure that all Base64-encoded characters which affect perl pattern matching are escaped. | |
# For example, '+' in the variable indicates 'one or more of the preceding character', | |
# whilst \+ indicates a literal + in the input string. | |
$old_cert_line = 'MIIEiDCCA3CgAwIBAgIQOBNA\+hb81eyfqXol6z3klDANBgkqhkiG9w0BAQUFADA2'; | |
while (<>) { | |
if (/$old_cert_line/) { | |
$delete = 1; | |
} | |
if ($ended) { | |
print $_; | |
} else { | |
push @lines, $_; | |
if ($delete && /<\/KeyDescriptor/) { | |
while ((pop @lines) !~ /<KeyDescriptor/) { | |
# remove the KeyDescriptor body back to its initial line | |
} | |
undef $delete; | |
} | |
} | |
# at the end... | |
if (/<\/EntityDescriptor>/) { | |
# re-export the old file | |
while ($line = shift @lines) { | |
print $line; | |
} | |
$ended = 1; | |
} | |
} | |
# end |