| 1 | Test Data Format |
|---|
| 2 | ================ |
|---|
| 3 | |
|---|
| 4 | A test data file is an ASCII text file composed of sections separated by |
|---|
| 5 | blank lines. Each section is stand-alone and independent of other |
|---|
| 6 | sections that may be in the same file, and contains one or more tests. |
|---|
| 7 | |
|---|
| 8 | A section is composed of a sequence of fields. Each field is one or more |
|---|
| 9 | lines composed of a field name, followed by a colon (":"), followed by a |
|---|
| 10 | field body. All but the last line of a field must end with a backslash |
|---|
| 11 | ("\"). If any line contains a hash mark ("#"), the hash mark and |
|---|
| 12 | everything after it on the same line is not considered part of the field |
|---|
| 13 | body. |
|---|
| 14 | |
|---|
| 15 | Each section must contain fields named AlgorithmType, Name, Source, and |
|---|
| 16 | Test. The presence and semantics of other fields depend on the algorithm |
|---|
| 17 | being tested and the tests to be run. |
|---|
| 18 | |
|---|
| 19 | Each section may contain more than one test and therefore more than one |
|---|
| 20 | field named Test. In that case the order of the fields is significant. A |
|---|
| 21 | test should always use the last field with any given name that occurs |
|---|
| 22 | before the Test field. |
|---|
| 23 | |
|---|
| 24 | Data Types |
|---|
| 25 | ========== |
|---|
| 26 | |
|---|
| 27 | int - small integer (less than 2^32) in decimal representation |
|---|
| 28 | string - human readable string |
|---|
| 29 | encoded string - can be one of the following |
|---|
| 30 | - quoted string: "message" means "message" without the quotes |
|---|
| 31 | or terminating '\0' |
|---|
| 32 | - hex encoded string: 0x74657374 or 74657374 means "test" |
|---|
| 33 | - repeated string: r100 "message" to repeat "message" 100 times, or |
|---|
| 34 | r256 0x0011 to repeat 0x0011 256 times |
|---|
| 35 | |
|---|
| 36 | Field Types |
|---|
| 37 | =========== |
|---|
| 38 | |
|---|
| 39 | AlgorithmType - string, for example "Signature", "AsymmetricCipher", |
|---|
| 40 | "SymmetricCipher", "MAC", "MessageDigest", or "KeyFactory" |
|---|
| 41 | Name - string, an algorithm name from SCAN |
|---|
| 42 | Test - string, identifies the test to run |
|---|
| 43 | Source - string, text explaining where the test data came from |
|---|
| 44 | Comment - string, other comments about the test data |
|---|
| 45 | KeyFormat - string, specifies the key format. "Component" here means |
|---|
| 46 | each component of the key or key pair is specified separately as a name, |
|---|
| 47 | value pair, with the names depending on the algorithm being tested. |
|---|
| 48 | Otherwise the value names "Key", or "PublicKey" and "PrivateKey" are |
|---|
| 49 | used. |
|---|
| 50 | Key - encoded string |
|---|
| 51 | PublicKey - encoded string |
|---|
| 52 | PrivateKey - encoded string |
|---|
| 53 | Modulus - the modulus when KeyFormat=Component |
|---|
| 54 | SubgroupOrder - the subgroup order when KeyFormat=Component |
|---|
| 55 | SubgroupGenerator - the subgroup generator when KeyFormat=Component |
|---|
| 56 | PublicElement - the public element when KeyFormat=Component |
|---|
| 57 | PrivateExponent - the private exponent when KeyFormat=Component |
|---|
| 58 | Message - encoded string, message to be signed or verified |
|---|
| 59 | Signature - encoded string, signature to be verified or compared with |
|---|
| 60 | Plaintext - encoded string |
|---|
| 61 | Ciphertext - encoded string |
|---|
| 62 | Header - encoded string |
|---|
| 63 | Footer - encoded string |
|---|
| 64 | DerivedKey - encoded string |
|---|
| 65 | DerivedLength - encoded string |
|---|
| 66 | Digest - encoded string |
|---|
| 67 | TruncatedSize - int, size of truncated digest in bytes |
|---|
| 68 | Seek - int, seek location for random access ciphers |
|---|
| 69 | (more to come here) |
|---|
| 70 | |
|---|
| 71 | Possible Tests |
|---|
| 72 | ============== |
|---|
| 73 | |
|---|
| 74 | KeyPairValidAndConsistent - public and private keys are both valid and |
|---|
| 75 | consistent with each other |
|---|
| 76 | PublicKeyInvalid - public key validation should not pass |
|---|
| 77 | PrivateKeyInvalid - private key validation should not pass |
|---|
| 78 | Verify - signature/digest/MAC verification should pass |
|---|
| 79 | VerifyTruncated - truncated digest/MAC verification should pass |
|---|
| 80 | NotVerify - signature/digest/MAC verification should not pass |
|---|
| 81 | DeterministicSign - sign message using given seed, and the resulting |
|---|
| 82 | signature should be equal to the given signature |
|---|
| 83 | DecryptMatch - ciphertext decrypts to plaintext |
|---|
| 84 | |
|---|
| 85 | (more to come here) |
|---|