Skip to content

Commit

Permalink
Add a tool to remove the old Eduserv gateway certificate from all aff…
Browse files Browse the repository at this point in the history
…ected entities once it has expired.
  • Loading branch information
iay committed Jul 29, 2008
1 parent 43c8aa5 commit 575be62
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
19 changes: 19 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,25 @@
</for>
</target>

<!--
Utility to remove the old Eduserv gateway certificate.
-->
<target name="remove.old.eduserv.cert">
<echo>Removing old Eduserv gateway certificate</echo>
<for param="file">
<path>
<fileset dir="${entities.dir}" includes="uk*.xml"/>
</path>
<sequential>
<exec executable="perl" dir="${entities.dir}">
<arg value="-i"/>
<arg value="${build.dir}/remove_old_eduserv_cert.pl"/>
<arg value="@{file}"/>
</exec>
</sequential>
</for>
</target>

<!--
Utility to add the second Eduserv gateway certificate.
-->
Expand Down
41 changes: 41 additions & 0 deletions build/remove_old_eduserv_cert.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/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
$old_cert_line = 'MIIDaTCCAtKgAwIBAgIQLqPCly3VfA8B2xVsTv59ajANBgkqhkiG9w0BAQUFADCB';

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

0 comments on commit 575be62

Please sign in to comment.