Commit fdf56a9b authored by Gary Wong's avatar Gary Wong

Pacify Perl, and anybody who thinks that 2^32 is a really really big

number.
parent 0486b553
......@@ -513,8 +513,9 @@ sub Sign($$)
#
# Create a template xml file to sign.
#
my $id = sprintf( "%08X%08X", int( rand( 0x100000000 ) ),
int( rand( 0x100000000 ) ) );
my $id = sprintf( "%04X%04X%04X%04X", int( rand( 0x10000 ) ),
int( rand( 0x10000 ) ), int( rand( 0x10000 ) ),
int( rand( 0x10000 ) ) );
my $template =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n".
"<credential xml:id=\"ref$id\">\n".
......
......@@ -208,7 +208,7 @@ while True:
doc.getElementsByTagName( "credential" ) ):
break
c.setAttribute( "xml:id", "ref" + str( id ) )
c.setAttribute( "xml:id", str( id ) )
c.appendChild( Lookup( old, "type" ).cloneNode( True ) )
c.appendChild( SimpleNode( doc, "serial", "1" ) )
......@@ -262,7 +262,7 @@ p.appendChild( old )
c.appendChild( p )
signature = doc.createElement( "Signature" );
signature.setAttribute( "xml:id", "Sig_ref" + str( id ) )
signature.setAttribute( "xml:id", "Sig_" + str( id ) )
signature.setAttribute( "xmlns", "http://www.w3.org/2000/09/xmldsig#" )
Lookup( doc.documentElement, "signatures" ).appendChild( signature )
signedinfo = doc.createElement( "SignedInfo" )
......@@ -276,7 +276,7 @@ sigmeth.setAttribute( "Algorithm",
"http://www.w3.org/2000/09/xmldsig#rsa-sha1" )
signedinfo.appendChild( sigmeth )
reference = doc.createElement( "Reference" );
reference.setAttribute( "URI", "#ref" + str( id ) )
reference.setAttribute( "URI", "#" + str( id ) )
signedinfo.appendChild( reference )
transforms = doc.createElement( "Transforms" )
reference.appendChild( transforms )
......@@ -313,7 +313,7 @@ doc.writexml( tmpfile )
tmpfile.flush()
ret = os.spawnlp( os.P_WAIT, XMLSEC1, XMLSEC1, "--sign", "--node-id",
"Sig_ref" + str( id ), "--privkey-pem",
"Sig_" + str( id ), "--privkey-pem",
CERTIFICATE + "," + CERTIFICATE, tmpfile.name )
if ret == 127:
print >> sys.stderr, XMLSEC1 + ": invocation error\n"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment