|
Revision 259, 1.5 kB
(checked in by ocjhb, 3 years ago)
|
|
first crypto cleanup
|
-
Property svn:mime-type set to
text/plain
-
Property svn:eol-style set to
native
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | from containerbase import * |
|---|
| 2 | import occrypto |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | class CDD (Container): |
|---|
| 6 | "Currency Description Document" |
|---|
| 7 | |
|---|
| 8 | fields = [ |
|---|
| 9 | Field('standardId'), |
|---|
| 10 | Field('currencyId'), |
|---|
| 11 | Field('shortCurrencyId'), |
|---|
| 12 | Field('issuerServiceLocation'), |
|---|
| 13 | Field('denominations'), |
|---|
| 14 | Field('issuerCipherSuite'), |
|---|
| 15 | Field('options'), |
|---|
| 16 | OneItemField('masterPubKey',klass=occrypto.PubKey), |
|---|
| 17 | Field('issuer'), |
|---|
| 18 | Field('version'), |
|---|
| 19 | Field('signature',signing=False) |
|---|
| 20 | ] |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | class MKC(Container): |
|---|
| 24 | "Mint Key Certificate" |
|---|
| 25 | |
|---|
| 26 | fields = [ |
|---|
| 27 | Field('keyId'), |
|---|
| 28 | Field('currencyId'), |
|---|
| 29 | Field('denomination'), |
|---|
| 30 | DateField('notBefore'), |
|---|
| 31 | DateField('keyNotAfter'), |
|---|
| 32 | DateField('coinNotAfter'), |
|---|
| 33 | OneItemField('publicKey',klass=occrypto.PubKey), |
|---|
| 34 | Field('issuer'), |
|---|
| 35 | Field('signature',signing=False) |
|---|
| 36 | ] |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | class Coin(Container): |
|---|
| 40 | fields = [ |
|---|
| 41 | Field('standardId'), |
|---|
| 42 | Field('currencyId'), |
|---|
| 43 | Field('denomination'), |
|---|
| 44 | Field('keyId'), |
|---|
| 45 | Field('serial'), |
|---|
| 46 | Field('signature',signing=False) |
|---|
| 47 | ] |
|---|
| 48 | |
|---|
| 49 | def setNewSerial(self): |
|---|
| 50 | self.serial = occrypto.createSerial() |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | if __name__ == "__main__": |
|---|
| 56 | import doctest,sys |
|---|
| 57 | if len(sys.argv) > 1 and sys.argv[-1] != '-v': |
|---|
| 58 | name = sys.argv[-1] |
|---|
| 59 | gb = globals() |
|---|
| 60 | verbose = '-v' in sys.argv |
|---|
| 61 | doctest.run_docstring_examples(gb[name],gb,verbose,name) |
|---|
| 62 | else: |
|---|
| 63 | doctest.testmod(optionflags=doctest.ELLIPSIS) |
|---|