urda / nistbeacon

Python 3 Library to access the NIST Randomness Beacon
https://urda.github.io/nistbeacon/
Apache License 2.0
10 stars 2 forks source link

NIST might be using `xmlns`, NistBeaconValue should handle this change #9

Closed urda closed 8 years ago

urda commented 8 years ago

The NIST Beacon might be using xmlns (XML Namespaces) going forward. Previously a record request would look like:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<record>
    <version>Version 1.0</version>
    <frequency>60</frequency>
    <timeStamp>1447873020</timeStamp>
    <seedValue>
        6189C4FF1F17ED41F9FF017CEB82DB2579193FBBB867B95E7FEBA52E74C937377626C522
        454C6223B25C007BF09C4B3AB55D24CFE1EB8F67C306FA75147E1CD2
    </seedValue>
    <previousOutputValue>
        F4F571DFBA7DA2D3872AF1696B6A32B5039EB9CABF03CBB17EAB095D83B1483A12CE2D03
        47BEAF2709CA0BAC0EB78C330D20CD3BE2FBEC2F7816AB2BB953AA3D
    </previousOutputValue>
    <signatureValue>
        F029F1A167DDBC17C041B9EB0A6AF2BC417D42C75001E39C2F9E2281AB9533B34ACBB584
        414AC10C20322F72C53D6425F3C595ECA31A0B26A23D0573DCA6DEADE09D02214A7F9AF7
        EC0424D69B26EAF7269C648349AD189D90A43D67576BF4B00035118F1AD939D228489A37
        EF822FEB04C2B4D1676B1041EC92883101150AAF7747EC88FE176BCA1B289E608E04CAF4
        CF47BE16A1B6243F8330E539740B9F6EB70A7A8E06777932B98617745AA2B545EFFA0DAA
        8DE016D00B55B01AEC91000508ACC4908D17A17311C68D156D63A03110250CB959A023BA
        75C700FE4EB43543DC1AC35781FF91D72AA7FE467F83569318C83D316801CC7159E83E2C
        306ADC2D
    </signatureValue>
    <outputValue>
        2BE1468DF2E4081306002B9F9E344C7826DDC225583ED7FACC8804086867457DD4F4BD2D
        F9F5CE4B88DF6E30E4838F15168946BE18DFF596E667EC543AC08F54
    </outputValue>
    <statusCode>0</statusCode>
</record>

But today it looks like:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<record xmlns="http://beacon.nist.gov/record/0.1/">
    <version>Version 1.0</version>
    <frequency>60</frequency>
    <timeStamp>1447873020</timeStamp>
    <seedValue>
        6189C4FF1F17ED41F9FF017CEB82DB2579193FBBB867B95E7FEBA52E74C937377626C522
        454C6223B25C007BF09C4B3AB55D24CFE1EB8F67C306FA75147E1CD2
    </seedValue>
    <previousOutputValue>
        F4F571DFBA7DA2D3872AF1696B6A32B5039EB9CABF03CBB17EAB095D83B1483A12CE2D03
        47BEAF2709CA0BAC0EB78C330D20CD3BE2FBEC2F7816AB2BB953AA3D
    </previousOutputValue>
    <signatureValue>
        F029F1A167DDBC17C041B9EB0A6AF2BC417D42C75001E39C2F9E2281AB9533B34ACBB584
        414AC10C20322F72C53D6425F3C595ECA31A0B26A23D0573DCA6DEADE09D02214A7F9AF7
        EC0424D69B26EAF7269C648349AD189D90A43D67576BF4B00035118F1AD939D228489A37
        EF822FEB04C2B4D1676B1041EC92883101150AAF7747EC88FE176BCA1B289E608E04CAF4
        CF47BE16A1B6243F8330E539740B9F6EB70A7A8E06777932B98617745AA2B545EFFA0DAA
        8DE016D00B55B01AEC91000508ACC4908D17A17311C68D156D63A03110250CB959A023BA
        75C700FE4EB43543DC1AC35781FF91D72AA7FE467F83569318C83D316801CC7159E83E2C
        306ADC2D
    </signatureValue>
    <outputValue>
        2BE1468DF2E4081306002B9F9E344C7826DDC225583ED7FACC8804086867457DD4F4BD2D
        F9F5CE4B88DF6E30E4838F15168946BE18DFF596E667EC543AC08F54
    </outputValue>
    <statusCode>0</statusCode>
</record>

Which produces a diff of:

--- ./1447873020.old.xml    2015-12-20 15:09:27.000000000 -0500
+++ ./1447873020.xml    2015-12-20 15:09:29.000000000 -0500
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<record>
+<record xmlns="http://beacon.nist.gov/record/0.1/">
     <version>Version 1.0</version>
     <frequency>60</frequency>
     <timeStamp>1447873020</timeStamp>

This change was discovered with issue #8 when nistbeacon broke down. nistbeacon should be prepared for possible namespaces going forward.

urda commented 8 years ago

Reviewing after downtime:

Where I think the beacon frozen all day: https://beacon.nist.gov/rest/record/1450540260

The (now) available next record: https://beacon.nist.gov/rest/record/next/1450540260


Looks like xmlns is here to stay. I reached out to NIST to check about the work done over the weekend as the downtime message is still displayed on their service pages.

urda commented 8 years ago

Closed with 6cb4cc7be931c204d17de1ffd4d567e1aa29afd7

urda commented 8 years ago

For reference, this was confirmed with the following:

$ curl https://beacon.nist.gov/rest/record/1378395540

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<record xmlns="http://beacon.nist.gov/record/0.1/">
<version>Version 1.0</version>
...