1// Code generated by github.com/atombender/go-jsonschema, DO NOT EDIT.23package wycheproof45import "encoding/json"6import "fmt"7import "reflect"8import "unicode/utf8"910type AeadTestGroup struct {11 // the IV size in bits12 IvSize int `json:"ivSize"`1314 // the keySize in bits15 KeySize int `json:"keySize"`1617 // Source corresponds to the JSON schema field "source".18 Source Source `json:"source"`1920 // the expected size of the tag in bits21 TagSize int `json:"tagSize"`2223 // Tests corresponds to the JSON schema field "tests".24 Tests []AeadTestVector `json:"tests"`2526 // Type corresponds to the JSON schema field "type".27 Type AeadTestGroupType `json:"type"`28}2930type AeadTestGroupType string3132const AeadTestGroupTypeAeadTest AeadTestGroupType = "AeadTest"3334var enumValues_AeadTestGroupType = []interface{}{35 "AeadTest",36}3738// UnmarshalJSON implements json.Unmarshaler.39func (j *AeadTestGroupType) UnmarshalJSON(value []byte) error {40 var v string41 if err := json.Unmarshal(value, &v); err != nil {42 return err43 }44 var ok bool45 for _, expected := range enumValues_AeadTestGroupType {46 if reflect.DeepEqual(v, expected) {47 ok = true48 break49 }50 }51 if !ok {52 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AeadTestGroupType, v)53 }54 *j = AeadTestGroupType(v)55 return nil56}5758// UnmarshalJSON implements json.Unmarshaler.59func (j *AeadTestGroup) UnmarshalJSON(value []byte) error {60 var raw map[string]interface{}61 if err := json.Unmarshal(value, &raw); err != nil {62 return err63 }64 if _, ok := raw["ivSize"]; raw != nil && !ok {65 return fmt.Errorf("field ivSize in AeadTestGroup: required")66 }67 if _, ok := raw["keySize"]; raw != nil && !ok {68 return fmt.Errorf("field keySize in AeadTestGroup: required")69 }70 if _, ok := raw["source"]; raw != nil && !ok {71 return fmt.Errorf("field source in AeadTestGroup: required")72 }73 if _, ok := raw["tagSize"]; raw != nil && !ok {74 return fmt.Errorf("field tagSize in AeadTestGroup: required")75 }76 if _, ok := raw["tests"]; raw != nil && !ok {77 return fmt.Errorf("field tests in AeadTestGroup: required")78 }79 if _, ok := raw["type"]; raw != nil && !ok {80 return fmt.Errorf("field type in AeadTestGroup: required")81 }82 type Plain AeadTestGroup83 var plain Plain84 if err := json.Unmarshal(value, &plain); err != nil {85 return err86 }87 *j = AeadTestGroup(plain)88 return nil89}9091type AeadTestSchemaV1Json struct {92 // the primitive tested in the test file93 Algorithm string `json:"algorithm"`9495 // DEPRECATED: prefer "source" property in test group96 GeneratorVersion *string `json:"generatorVersion,omitempty,omitzero"`9798 // additional documentation99 Header []string `json:"header"`100101 // Notes corresponds to the JSON schema field "notes".102 Notes Notes `json:"notes"`103104 // the number of test vectors in this test105 NumberOfTests int `json:"numberOfTests"`106107 // Schema corresponds to the JSON schema field "schema".108 Schema AeadTestSchemaV1JsonSchema `json:"schema"`109110 // TestGroups corresponds to the JSON schema field "testGroups".111 TestGroups []AeadTestGroup `json:"testGroups"`112}113114type AeadTestSchemaV1JsonSchema string115116const AeadTestSchemaV1JsonSchemaAeadTestSchemaV1Json AeadTestSchemaV1JsonSchema = "aead_test_schema_v1.json"117118var enumValues_AeadTestSchemaV1JsonSchema = []interface{}{119 "aead_test_schema_v1.json",120}121122// UnmarshalJSON implements json.Unmarshaler.123func (j *AeadTestSchemaV1JsonSchema) UnmarshalJSON(value []byte) error {124 var v string125 if err := json.Unmarshal(value, &v); err != nil {126 return err127 }128 var ok bool129 for _, expected := range enumValues_AeadTestSchemaV1JsonSchema {130 if reflect.DeepEqual(v, expected) {131 ok = true132 break133 }134 }135 if !ok {136 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AeadTestSchemaV1JsonSchema, v)137 }138 *j = AeadTestSchemaV1JsonSchema(v)139 return nil140}141142// UnmarshalJSON implements json.Unmarshaler.143func (j *AeadTestSchemaV1Json) UnmarshalJSON(value []byte) error {144 var raw map[string]interface{}145 if err := json.Unmarshal(value, &raw); err != nil {146 return err147 }148 if _, ok := raw["algorithm"]; raw != nil && !ok {149 return fmt.Errorf("field algorithm in AeadTestSchemaV1Json: required")150 }151 if _, ok := raw["header"]; raw != nil && !ok {152 return fmt.Errorf("field header in AeadTestSchemaV1Json: required")153 }154 if _, ok := raw["notes"]; raw != nil && !ok {155 return fmt.Errorf("field notes in AeadTestSchemaV1Json: required")156 }157 if _, ok := raw["numberOfTests"]; raw != nil && !ok {158 return fmt.Errorf("field numberOfTests in AeadTestSchemaV1Json: required")159 }160 if _, ok := raw["schema"]; raw != nil && !ok {161 return fmt.Errorf("field schema in AeadTestSchemaV1Json: required")162 }163 if _, ok := raw["testGroups"]; raw != nil && !ok {164 return fmt.Errorf("field testGroups in AeadTestSchemaV1Json: required")165 }166 type Plain AeadTestSchemaV1Json167 var plain Plain168 if err := json.Unmarshal(value, &plain); err != nil {169 return err170 }171 *j = AeadTestSchemaV1Json(plain)172 return nil173}174175type AeadTestVector struct {176 // additional authenticated data177 Aad string `json:"aad"`178179 // A brief description of the test case180 Comment string `json:"comment"`181182 // the ciphertext (without iv and tag)183 Ct string `json:"ct"`184185 // A list of flags186 Flags []string `json:"flags"`187188 // the nonce189 Iv string `json:"iv"`190191 // the key192 Key string `json:"key"`193194 // the plaintext195 Msg string `json:"msg"`196197 // Result corresponds to the JSON schema field "result".198 Result Result `json:"result"`199200 // the authentication tag201 Tag string `json:"tag"`202203 // Identifier of the test case204 TcId int `json:"tcId"`205}206207// UnmarshalJSON implements json.Unmarshaler.208func (j *AeadTestVector) UnmarshalJSON(value []byte) error {209 var raw map[string]interface{}210 if err := json.Unmarshal(value, &raw); err != nil {211 return err212 }213 if _, ok := raw["aad"]; raw != nil && !ok {214 return fmt.Errorf("field aad in AeadTestVector: required")215 }216 if _, ok := raw["comment"]; raw != nil && !ok {217 return fmt.Errorf("field comment in AeadTestVector: required")218 }219 if _, ok := raw["ct"]; raw != nil && !ok {220 return fmt.Errorf("field ct in AeadTestVector: required")221 }222 if _, ok := raw["flags"]; raw != nil && !ok {223 return fmt.Errorf("field flags in AeadTestVector: required")224 }225 if _, ok := raw["iv"]; raw != nil && !ok {226 return fmt.Errorf("field iv in AeadTestVector: required")227 }228 if _, ok := raw["key"]; raw != nil && !ok {229 return fmt.Errorf("field key in AeadTestVector: required")230 }231 if _, ok := raw["msg"]; raw != nil && !ok {232 return fmt.Errorf("field msg in AeadTestVector: required")233 }234 if _, ok := raw["result"]; raw != nil && !ok {235 return fmt.Errorf("field result in AeadTestVector: required")236 }237 if _, ok := raw["tag"]; raw != nil && !ok {238 return fmt.Errorf("field tag in AeadTestVector: required")239 }240 if _, ok := raw["tcId"]; raw != nil && !ok {241 return fmt.Errorf("field tcId in AeadTestVector: required")242 }243 type Plain AeadTestVector244 var plain Plain245 if err := json.Unmarshal(value, &plain); err != nil {246 return err247 }248 *j = AeadTestVector(plain)249 return nil250}251252type AsnSignatureTestVector struct {253 // A brief description of the test case254 Comment string `json:"comment"`255256 // A list of flags257 Flags []string `json:"flags"`258259 // The message to sign260 Msg string `json:"msg"`261262 // Result corresponds to the JSON schema field "result".263 Result Result `json:"result"`264265 // An ASN encoded signature for msg266 Sig string `json:"sig"`267268 // Identifier of the test case269 TcId int `json:"tcId"`270}271272// UnmarshalJSON implements json.Unmarshaler.273func (j *AsnSignatureTestVector) UnmarshalJSON(value []byte) error {274 var raw map[string]interface{}275 if err := json.Unmarshal(value, &raw); err != nil {276 return err277 }278 if _, ok := raw["comment"]; raw != nil && !ok {279 return fmt.Errorf("field comment in AsnSignatureTestVector: required")280 }281 if _, ok := raw["flags"]; raw != nil && !ok {282 return fmt.Errorf("field flags in AsnSignatureTestVector: required")283 }284 if _, ok := raw["msg"]; raw != nil && !ok {285 return fmt.Errorf("field msg in AsnSignatureTestVector: required")286 }287 if _, ok := raw["result"]; raw != nil && !ok {288 return fmt.Errorf("field result in AsnSignatureTestVector: required")289 }290 if _, ok := raw["sig"]; raw != nil && !ok {291 return fmt.Errorf("field sig in AsnSignatureTestVector: required")292 }293 if _, ok := raw["tcId"]; raw != nil && !ok {294 return fmt.Errorf("field tcId in AsnSignatureTestVector: required")295 }296 type Plain AsnSignatureTestVector297 var plain Plain298 if err := json.Unmarshal(value, &plain); err != nil {299 return err300 }301 *j = AsnSignatureTestVector(plain)302 return nil303}304305type BlsAggregateVerifySchemaJson struct {306 // The primitive tested in the test file307 Algorithm string `json:"algorithm"`308309 // Additional documentation310 Header []string `json:"header"`311312 // Notes corresponds to the JSON schema field "notes".313 Notes Notes `json:"notes"`314315 // The number of test vectors in this test316 NumberOfTests int `json:"numberOfTests"`317318 // Schema corresponds to the JSON schema field "schema".319 Schema BlsAggregateVerifySchemaJsonSchema `json:"schema"`320321 // TestGroups corresponds to the JSON schema field "testGroups".322 TestGroups []BlsAggregateVerifyTestGroup `json:"testGroups"`323}324325type BlsAggregateVerifySchemaJsonSchema string326327const BlsAggregateVerifySchemaJsonSchemaBlsAggregateVerifySchemaJson BlsAggregateVerifySchemaJsonSchema = "bls_aggregate_verify_schema.json"328329var enumValues_BlsAggregateVerifySchemaJsonSchema = []interface{}{330 "bls_aggregate_verify_schema.json",331}332333// UnmarshalJSON implements json.Unmarshaler.334func (j *BlsAggregateVerifySchemaJsonSchema) UnmarshalJSON(value []byte) error {335 var v string336 if err := json.Unmarshal(value, &v); err != nil {337 return err338 }339 var ok bool340 for _, expected := range enumValues_BlsAggregateVerifySchemaJsonSchema {341 if reflect.DeepEqual(v, expected) {342 ok = true343 break344 }345 }346 if !ok {347 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BlsAggregateVerifySchemaJsonSchema, v)348 }349 *j = BlsAggregateVerifySchemaJsonSchema(v)350 return nil351}352353// UnmarshalJSON implements json.Unmarshaler.354func (j *BlsAggregateVerifySchemaJson) UnmarshalJSON(value []byte) error {355 var raw map[string]interface{}356 if err := json.Unmarshal(value, &raw); err != nil {357 return err358 }359 if _, ok := raw["algorithm"]; raw != nil && !ok {360 return fmt.Errorf("field algorithm in BlsAggregateVerifySchemaJson: required")361 }362 if _, ok := raw["header"]; raw != nil && !ok {363 return fmt.Errorf("field header in BlsAggregateVerifySchemaJson: required")364 }365 if _, ok := raw["notes"]; raw != nil && !ok {366 return fmt.Errorf("field notes in BlsAggregateVerifySchemaJson: required")367 }368 if _, ok := raw["numberOfTests"]; raw != nil && !ok {369 return fmt.Errorf("field numberOfTests in BlsAggregateVerifySchemaJson: required")370 }371 if _, ok := raw["schema"]; raw != nil && !ok {372 return fmt.Errorf("field schema in BlsAggregateVerifySchemaJson: required")373 }374 if _, ok := raw["testGroups"]; raw != nil && !ok {375 return fmt.Errorf("field testGroups in BlsAggregateVerifySchemaJson: required")376 }377 type Plain BlsAggregateVerifySchemaJson378 var plain Plain379 if err := json.Unmarshal(value, &plain); err != nil {380 return err381 }382 *j = BlsAggregateVerifySchemaJson(plain)383 return nil384}385386type BlsAggregateVerifyTestGroup struct {387 // The BLS ciphersuite identifier388 Ciphersuite string `json:"ciphersuite"`389390 // Source corresponds to the JSON schema field "source".391 Source Source `json:"source"`392393 // Tests corresponds to the JSON schema field "tests".394 Tests []BlsAggregateVerifyTestVector `json:"tests"`395396 // Type corresponds to the JSON schema field "type".397 Type BlsAggregateVerifyTestGroupType `json:"type"`398}399400type BlsAggregateVerifyTestGroupType string401402const BlsAggregateVerifyTestGroupTypeBlsAggregateVerify BlsAggregateVerifyTestGroupType = "BlsAggregateVerify"403404var enumValues_BlsAggregateVerifyTestGroupType = []interface{}{405 "BlsAggregateVerify",406}407408// UnmarshalJSON implements json.Unmarshaler.409func (j *BlsAggregateVerifyTestGroupType) UnmarshalJSON(value []byte) error {410 var v string411 if err := json.Unmarshal(value, &v); err != nil {412 return err413 }414 var ok bool415 for _, expected := range enumValues_BlsAggregateVerifyTestGroupType {416 if reflect.DeepEqual(v, expected) {417 ok = true418 break419 }420 }421 if !ok {422 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BlsAggregateVerifyTestGroupType, v)423 }424 *j = BlsAggregateVerifyTestGroupType(v)425 return nil426}427428// UnmarshalJSON implements json.Unmarshaler.429func (j *BlsAggregateVerifyTestGroup) UnmarshalJSON(value []byte) error {430 var raw map[string]interface{}431 if err := json.Unmarshal(value, &raw); err != nil {432 return err433 }434 if _, ok := raw["ciphersuite"]; raw != nil && !ok {435 return fmt.Errorf("field ciphersuite in BlsAggregateVerifyTestGroup: required")436 }437 if _, ok := raw["source"]; raw != nil && !ok {438 return fmt.Errorf("field source in BlsAggregateVerifyTestGroup: required")439 }440 if _, ok := raw["tests"]; raw != nil && !ok {441 return fmt.Errorf("field tests in BlsAggregateVerifyTestGroup: required")442 }443 if _, ok := raw["type"]; raw != nil && !ok {444 return fmt.Errorf("field type in BlsAggregateVerifyTestGroup: required")445 }446 type Plain BlsAggregateVerifyTestGroup447 var plain Plain448 if err := json.Unmarshal(value, &plain); err != nil {449 return err450 }451 *j = BlsAggregateVerifyTestGroup(plain)452 return nil453}454455type BlsAggregateVerifyTestVector struct {456 // A brief description of the test case457 Comment string `json:"comment"`458459 // A list of flags460 Flags []string `json:"flags"`461462 // The messages that were signed463 Messages []string `json:"messages"`464465 // The compressed public keys466 Pubkeys []string `json:"pubkeys"`467468 // Result corresponds to the JSON schema field "result".469 Result Result `json:"result"`470471 // The aggregated BLS signature in compressed form472 Sig string `json:"sig"`473474 // Identifier of the test case475 TcId int `json:"tcId"`476}477478// UnmarshalJSON implements json.Unmarshaler.479func (j *BlsAggregateVerifyTestVector) UnmarshalJSON(value []byte) error {480 var raw map[string]interface{}481 if err := json.Unmarshal(value, &raw); err != nil {482 return err483 }484 if _, ok := raw["comment"]; raw != nil && !ok {485 return fmt.Errorf("field comment in BlsAggregateVerifyTestVector: required")486 }487 if _, ok := raw["flags"]; raw != nil && !ok {488 return fmt.Errorf("field flags in BlsAggregateVerifyTestVector: required")489 }490 if _, ok := raw["messages"]; raw != nil && !ok {491 return fmt.Errorf("field messages in BlsAggregateVerifyTestVector: required")492 }493 if _, ok := raw["pubkeys"]; raw != nil && !ok {494 return fmt.Errorf("field pubkeys in BlsAggregateVerifyTestVector: required")495 }496 if _, ok := raw["result"]; raw != nil && !ok {497 return fmt.Errorf("field result in BlsAggregateVerifyTestVector: required")498 }499 if _, ok := raw["sig"]; raw != nil && !ok {500 return fmt.Errorf("field sig in BlsAggregateVerifyTestVector: required")501 }502 if _, ok := raw["tcId"]; raw != nil && !ok {503 return fmt.Errorf("field tcId in BlsAggregateVerifyTestVector: required")504 }505 type Plain BlsAggregateVerifyTestVector506 var plain Plain507 if err := json.Unmarshal(value, &plain); err != nil {508 return err509 }510 *j = BlsAggregateVerifyTestVector(plain)511 return nil512}513514type BlsHashToG2SchemaJson struct {515 // The primitive tested in the test file516 Algorithm string `json:"algorithm"`517518 // Additional documentation519 Header []string `json:"header"`520521 // Notes corresponds to the JSON schema field "notes".522 Notes Notes `json:"notes"`523524 // The number of test vectors in this test525 NumberOfTests int `json:"numberOfTests"`526527 // Schema corresponds to the JSON schema field "schema".528 Schema BlsHashToG2SchemaJsonSchema `json:"schema"`529530 // TestGroups corresponds to the JSON schema field "testGroups".531 TestGroups []BlsHashToG2TestGroup `json:"testGroups"`532}533534type BlsHashToG2SchemaJsonSchema string535536const BlsHashToG2SchemaJsonSchemaBlsHashToG2SchemaJson BlsHashToG2SchemaJsonSchema = "bls_hash_to_g2_schema.json"537538var enumValues_BlsHashToG2SchemaJsonSchema = []interface{}{539 "bls_hash_to_g2_schema.json",540}541542// UnmarshalJSON implements json.Unmarshaler.543func (j *BlsHashToG2SchemaJsonSchema) UnmarshalJSON(value []byte) error {544 var v string545 if err := json.Unmarshal(value, &v); err != nil {546 return err547 }548 var ok bool549 for _, expected := range enumValues_BlsHashToG2SchemaJsonSchema {550 if reflect.DeepEqual(v, expected) {551 ok = true552 break553 }554 }555 if !ok {556 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BlsHashToG2SchemaJsonSchema, v)557 }558 *j = BlsHashToG2SchemaJsonSchema(v)559 return nil560}561562// UnmarshalJSON implements json.Unmarshaler.563func (j *BlsHashToG2SchemaJson) UnmarshalJSON(value []byte) error {564 var raw map[string]interface{}565 if err := json.Unmarshal(value, &raw); err != nil {566 return err567 }568 if _, ok := raw["algorithm"]; raw != nil && !ok {569 return fmt.Errorf("field algorithm in BlsHashToG2SchemaJson: required")570 }571 if _, ok := raw["header"]; raw != nil && !ok {572 return fmt.Errorf("field header in BlsHashToG2SchemaJson: required")573 }574 if _, ok := raw["notes"]; raw != nil && !ok {575 return fmt.Errorf("field notes in BlsHashToG2SchemaJson: required")576 }577 if _, ok := raw["numberOfTests"]; raw != nil && !ok {578 return fmt.Errorf("field numberOfTests in BlsHashToG2SchemaJson: required")579 }580 if _, ok := raw["schema"]; raw != nil && !ok {581 return fmt.Errorf("field schema in BlsHashToG2SchemaJson: required")582 }583 if _, ok := raw["testGroups"]; raw != nil && !ok {584 return fmt.Errorf("field testGroups in BlsHashToG2SchemaJson: required")585 }586 type Plain BlsHashToG2SchemaJson587 var plain Plain588 if err := json.Unmarshal(value, &plain); err != nil {589 return err590 }591 *j = BlsHashToG2SchemaJson(plain)592 return nil593}594595type BlsHashToG2TestGroup struct {596 // The domain separation tag used for hash_to_curve597 Dst string `json:"dst"`598599 // Source corresponds to the JSON schema field "source".600 Source Source `json:"source"`601602 // Tests corresponds to the JSON schema field "tests".603 Tests []BlsHashToG2TestVector `json:"tests"`604605 // Type corresponds to the JSON schema field "type".606 Type BlsHashToG2TestGroupType `json:"type"`607}608609type BlsHashToG2TestGroupType string610611const BlsHashToG2TestGroupTypeBlsHashToG2 BlsHashToG2TestGroupType = "BlsHashToG2"612613var enumValues_BlsHashToG2TestGroupType = []interface{}{614 "BlsHashToG2",615}616617// UnmarshalJSON implements json.Unmarshaler.618func (j *BlsHashToG2TestGroupType) UnmarshalJSON(value []byte) error {619 var v string620 if err := json.Unmarshal(value, &v); err != nil {621 return err622 }623 var ok bool624 for _, expected := range enumValues_BlsHashToG2TestGroupType {625 if reflect.DeepEqual(v, expected) {626 ok = true627 break628 }629 }630 if !ok {631 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BlsHashToG2TestGroupType, v)632 }633 *j = BlsHashToG2TestGroupType(v)634 return nil635}636637// UnmarshalJSON implements json.Unmarshaler.638func (j *BlsHashToG2TestGroup) UnmarshalJSON(value []byte) error {639 var raw map[string]interface{}640 if err := json.Unmarshal(value, &raw); err != nil {641 return err642 }643 if _, ok := raw["dst"]; raw != nil && !ok {644 return fmt.Errorf("field dst in BlsHashToG2TestGroup: required")645 }646 if _, ok := raw["source"]; raw != nil && !ok {647 return fmt.Errorf("field source in BlsHashToG2TestGroup: required")648 }649 if _, ok := raw["tests"]; raw != nil && !ok {650 return fmt.Errorf("field tests in BlsHashToG2TestGroup: required")651 }652 if _, ok := raw["type"]; raw != nil && !ok {653 return fmt.Errorf("field type in BlsHashToG2TestGroup: required")654 }655 type Plain BlsHashToG2TestGroup656 var plain Plain657 if err := json.Unmarshal(value, &plain); err != nil {658 return err659 }660 *j = BlsHashToG2TestGroup(plain)661 return nil662}663664type BlsHashToG2TestVector struct {665 // A brief description of the test case666 Comment string `json:"comment"`667668 // The expected hash-to-curve output point in compressed form669 Expected string `json:"expected"`670671 // A list of flags672 Flags []string `json:"flags"`673674 // The input message675 Msg string `json:"msg"`676677 // Result corresponds to the JSON schema field "result".678 Result Result `json:"result"`679680 // Identifier of the test case681 TcId int `json:"tcId"`682}683684// UnmarshalJSON implements json.Unmarshaler.685func (j *BlsHashToG2TestVector) UnmarshalJSON(value []byte) error {686 var raw map[string]interface{}687 if err := json.Unmarshal(value, &raw); err != nil {688 return err689 }690 if _, ok := raw["comment"]; raw != nil && !ok {691 return fmt.Errorf("field comment in BlsHashToG2TestVector: required")692 }693 if _, ok := raw["expected"]; raw != nil && !ok {694 return fmt.Errorf("field expected in BlsHashToG2TestVector: required")695 }696 if _, ok := raw["flags"]; raw != nil && !ok {697 return fmt.Errorf("field flags in BlsHashToG2TestVector: required")698 }699 if _, ok := raw["msg"]; raw != nil && !ok {700 return fmt.Errorf("field msg in BlsHashToG2TestVector: required")701 }702 if _, ok := raw["result"]; raw != nil && !ok {703 return fmt.Errorf("field result in BlsHashToG2TestVector: required")704 }705 if _, ok := raw["tcId"]; raw != nil && !ok {706 return fmt.Errorf("field tcId in BlsHashToG2TestVector: required")707 }708 type Plain BlsHashToG2TestVector709 var plain Plain710 if err := json.Unmarshal(value, &plain); err != nil {711 return err712 }713 *j = BlsHashToG2TestVector(plain)714 return nil715}716717type BlsPublicKey struct {718 // The group the public key belongs to719 Group BlsPublicKeyGroup `json:"group"`720721 // The size of the public key in bytes722 KeySize int `json:"keySize"`723724 // The compressed public key725 Pk string `json:"pk"`726}727728type BlsPublicKeyGroup string729730const BlsPublicKeyGroupG1 BlsPublicKeyGroup = "G1"731const BlsPublicKeyGroupG2 BlsPublicKeyGroup = "G2"732733var enumValues_BlsPublicKeyGroup = []interface{}{734 "G1",735 "G2",736}737738// UnmarshalJSON implements json.Unmarshaler.739func (j *BlsPublicKeyGroup) UnmarshalJSON(value []byte) error {740 var v string741 if err := json.Unmarshal(value, &v); err != nil {742 return err743 }744 var ok bool745 for _, expected := range enumValues_BlsPublicKeyGroup {746 if reflect.DeepEqual(v, expected) {747 ok = true748 break749 }750 }751 if !ok {752 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BlsPublicKeyGroup, v)753 }754 *j = BlsPublicKeyGroup(v)755 return nil756}757758// UnmarshalJSON implements json.Unmarshaler.759func (j *BlsPublicKey) UnmarshalJSON(value []byte) error {760 var raw map[string]interface{}761 if err := json.Unmarshal(value, &raw); err != nil {762 return err763 }764 if _, ok := raw["group"]; raw != nil && !ok {765 return fmt.Errorf("field group in BlsPublicKey: required")766 }767 if _, ok := raw["keySize"]; raw != nil && !ok {768 return fmt.Errorf("field keySize in BlsPublicKey: required")769 }770 if _, ok := raw["pk"]; raw != nil && !ok {771 return fmt.Errorf("field pk in BlsPublicKey: required")772 }773 type Plain BlsPublicKey774 var plain Plain775 if err := json.Unmarshal(value, &plain); err != nil {776 return err777 }778 *j = BlsPublicKey(plain)779 return nil780}781782type BlsSigVerifySchemaJson struct {783 // The primitive tested in the test file784 Algorithm string `json:"algorithm"`785786 // Additional documentation787 Header []string `json:"header"`788789 // Notes corresponds to the JSON schema field "notes".790 Notes Notes `json:"notes"`791792 // The number of test vectors in this test793 NumberOfTests int `json:"numberOfTests"`794795 // Schema corresponds to the JSON schema field "schema".796 Schema BlsSigVerifySchemaJsonSchema `json:"schema"`797798 // TestGroups corresponds to the JSON schema field "testGroups".799 TestGroups []BlsSigVerifyTestGroup `json:"testGroups"`800}801802type BlsSigVerifySchemaJsonSchema string803804const BlsSigVerifySchemaJsonSchemaBlsSigVerifySchemaJson BlsSigVerifySchemaJsonSchema = "bls_sig_verify_schema.json"805806var enumValues_BlsSigVerifySchemaJsonSchema = []interface{}{807 "bls_sig_verify_schema.json",808}809810// UnmarshalJSON implements json.Unmarshaler.811func (j *BlsSigVerifySchemaJsonSchema) UnmarshalJSON(value []byte) error {812 var v string813 if err := json.Unmarshal(value, &v); err != nil {814 return err815 }816 var ok bool817 for _, expected := range enumValues_BlsSigVerifySchemaJsonSchema {818 if reflect.DeepEqual(v, expected) {819 ok = true820 break821 }822 }823 if !ok {824 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BlsSigVerifySchemaJsonSchema, v)825 }826 *j = BlsSigVerifySchemaJsonSchema(v)827 return nil828}829830// UnmarshalJSON implements json.Unmarshaler.831func (j *BlsSigVerifySchemaJson) UnmarshalJSON(value []byte) error {832 var raw map[string]interface{}833 if err := json.Unmarshal(value, &raw); err != nil {834 return err835 }836 if _, ok := raw["algorithm"]; raw != nil && !ok {837 return fmt.Errorf("field algorithm in BlsSigVerifySchemaJson: required")838 }839 if _, ok := raw["header"]; raw != nil && !ok {840 return fmt.Errorf("field header in BlsSigVerifySchemaJson: required")841 }842 if _, ok := raw["notes"]; raw != nil && !ok {843 return fmt.Errorf("field notes in BlsSigVerifySchemaJson: required")844 }845 if _, ok := raw["numberOfTests"]; raw != nil && !ok {846 return fmt.Errorf("field numberOfTests in BlsSigVerifySchemaJson: required")847 }848 if _, ok := raw["schema"]; raw != nil && !ok {849 return fmt.Errorf("field schema in BlsSigVerifySchemaJson: required")850 }851 if _, ok := raw["testGroups"]; raw != nil && !ok {852 return fmt.Errorf("field testGroups in BlsSigVerifySchemaJson: required")853 }854 type Plain BlsSigVerifySchemaJson855 var plain Plain856 if err := json.Unmarshal(value, &plain); err != nil {857 return err858 }859 *j = BlsSigVerifySchemaJson(plain)860 return nil861}862863type BlsSigVerifyTestGroup struct {864 // The BLS ciphersuite identifier, e.g.865 // BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_866 Ciphersuite string `json:"ciphersuite"`867868 // PublicKey corresponds to the JSON schema field "publicKey".869 PublicKey BlsPublicKey `json:"publicKey"`870871 // Source corresponds to the JSON schema field "source".872 Source Source `json:"source"`873874 // Tests corresponds to the JSON schema field "tests".875 Tests []SignatureTestVector `json:"tests"`876877 // Type corresponds to the JSON schema field "type".878 Type BlsSigVerifyTestGroupType `json:"type"`879}880881type BlsSigVerifyTestGroupType string882883const BlsSigVerifyTestGroupTypeBlsSigVerify BlsSigVerifyTestGroupType = "BlsSigVerify"884885var enumValues_BlsSigVerifyTestGroupType = []interface{}{886 "BlsSigVerify",887}888889// UnmarshalJSON implements json.Unmarshaler.890func (j *BlsSigVerifyTestGroupType) UnmarshalJSON(value []byte) error {891 var v string892 if err := json.Unmarshal(value, &v); err != nil {893 return err894 }895 var ok bool896 for _, expected := range enumValues_BlsSigVerifyTestGroupType {897 if reflect.DeepEqual(v, expected) {898 ok = true899 break900 }901 }902 if !ok {903 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BlsSigVerifyTestGroupType, v)904 }905 *j = BlsSigVerifyTestGroupType(v)906 return nil907}908909// UnmarshalJSON implements json.Unmarshaler.910func (j *BlsSigVerifyTestGroup) UnmarshalJSON(value []byte) error {911 var raw map[string]interface{}912 if err := json.Unmarshal(value, &raw); err != nil {913 return err914 }915 if _, ok := raw["ciphersuite"]; raw != nil && !ok {916 return fmt.Errorf("field ciphersuite in BlsSigVerifyTestGroup: required")917 }918 if _, ok := raw["publicKey"]; raw != nil && !ok {919 return fmt.Errorf("field publicKey in BlsSigVerifyTestGroup: required")920 }921 if _, ok := raw["source"]; raw != nil && !ok {922 return fmt.Errorf("field source in BlsSigVerifyTestGroup: required")923 }924 if _, ok := raw["tests"]; raw != nil && !ok {925 return fmt.Errorf("field tests in BlsSigVerifyTestGroup: required")926 }927 if _, ok := raw["type"]; raw != nil && !ok {928 return fmt.Errorf("field type in BlsSigVerifyTestGroup: required")929 }930 type Plain BlsSigVerifyTestGroup931 var plain Plain932 if err := json.Unmarshal(value, &plain); err != nil {933 return err934 }935 *j = BlsSigVerifyTestGroup(plain)936 return nil937}938939type DaeadTestGroup struct {940 // the keySize in bits941 KeySize int `json:"keySize"`942943 // Source corresponds to the JSON schema field "source".944 Source Source `json:"source"`945946 // Tests corresponds to the JSON schema field "tests".947 Tests []DaeadTestVector `json:"tests"`948949 // Type corresponds to the JSON schema field "type".950 Type DaeadTestGroupType `json:"type"`951}952953type DaeadTestGroupType string954955const DaeadTestGroupTypeDaeadTest DaeadTestGroupType = "DaeadTest"956957var enumValues_DaeadTestGroupType = []interface{}{958 "DaeadTest",959}960961// UnmarshalJSON implements json.Unmarshaler.962func (j *DaeadTestGroupType) UnmarshalJSON(value []byte) error {963 var v string964 if err := json.Unmarshal(value, &v); err != nil {965 return err966 }967 var ok bool968 for _, expected := range enumValues_DaeadTestGroupType {969 if reflect.DeepEqual(v, expected) {970 ok = true971 break972 }973 }974 if !ok {975 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DaeadTestGroupType, v)976 }977 *j = DaeadTestGroupType(v)978 return nil979}980981// UnmarshalJSON implements json.Unmarshaler.982func (j *DaeadTestGroup) UnmarshalJSON(value []byte) error {983 var raw map[string]interface{}984 if err := json.Unmarshal(value, &raw); err != nil {985 return err986 }987 if _, ok := raw["keySize"]; raw != nil && !ok {988 return fmt.Errorf("field keySize in DaeadTestGroup: required")989 }990 if _, ok := raw["source"]; raw != nil && !ok {991 return fmt.Errorf("field source in DaeadTestGroup: required")992 }993 if _, ok := raw["tests"]; raw != nil && !ok {994 return fmt.Errorf("field tests in DaeadTestGroup: required")995 }996 if _, ok := raw["type"]; raw != nil && !ok {997 return fmt.Errorf("field type in DaeadTestGroup: required")998 }999 type Plain DaeadTestGroup1000 var plain Plain1001 if err := json.Unmarshal(value, &plain); err != nil {1002 return err1003 }1004 *j = DaeadTestGroup(plain)1005 return nil1006}10071008type DaeadTestSchemaV1Json struct {1009 // the primitive tested in the test file1010 Algorithm string `json:"algorithm"`10111012 // DEPRECATED: prefer "source" property in test group1013 GeneratorVersion *string `json:"generatorVersion,omitempty,omitzero"`10141015 // additional documentation1016 Header []string `json:"header"`10171018 // Notes corresponds to the JSON schema field "notes".1019 Notes Notes `json:"notes"`10201021 // the number of test vectors in this test1022 NumberOfTests int `json:"numberOfTests"`10231024 // Schema corresponds to the JSON schema field "schema".1025 Schema DaeadTestSchemaV1JsonSchema `json:"schema"`10261027 // TestGroups corresponds to the JSON schema field "testGroups".1028 TestGroups []DaeadTestGroup `json:"testGroups"`1029}10301031type DaeadTestSchemaV1JsonSchema string10321033const DaeadTestSchemaV1JsonSchemaDaeadTestSchemaV1Json DaeadTestSchemaV1JsonSchema = "daead_test_schema_v1.json"10341035var enumValues_DaeadTestSchemaV1JsonSchema = []interface{}{1036 "daead_test_schema_v1.json",1037}10381039// UnmarshalJSON implements json.Unmarshaler.1040func (j *DaeadTestSchemaV1JsonSchema) UnmarshalJSON(value []byte) error {1041 var v string1042 if err := json.Unmarshal(value, &v); err != nil {1043 return err1044 }1045 var ok bool1046 for _, expected := range enumValues_DaeadTestSchemaV1JsonSchema {1047 if reflect.DeepEqual(v, expected) {1048 ok = true1049 break1050 }1051 }1052 if !ok {1053 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DaeadTestSchemaV1JsonSchema, v)1054 }1055 *j = DaeadTestSchemaV1JsonSchema(v)1056 return nil1057}10581059// UnmarshalJSON implements json.Unmarshaler.1060func (j *DaeadTestSchemaV1Json) UnmarshalJSON(value []byte) error {1061 var raw map[string]interface{}1062 if err := json.Unmarshal(value, &raw); err != nil {1063 return err1064 }1065 if _, ok := raw["algorithm"]; raw != nil && !ok {1066 return fmt.Errorf("field algorithm in DaeadTestSchemaV1Json: required")1067 }1068 if _, ok := raw["header"]; raw != nil && !ok {1069 return fmt.Errorf("field header in DaeadTestSchemaV1Json: required")1070 }1071 if _, ok := raw["notes"]; raw != nil && !ok {1072 return fmt.Errorf("field notes in DaeadTestSchemaV1Json: required")1073 }1074 if _, ok := raw["numberOfTests"]; raw != nil && !ok {1075 return fmt.Errorf("field numberOfTests in DaeadTestSchemaV1Json: required")1076 }1077 if _, ok := raw["schema"]; raw != nil && !ok {1078 return fmt.Errorf("field schema in DaeadTestSchemaV1Json: required")1079 }1080 if _, ok := raw["testGroups"]; raw != nil && !ok {1081 return fmt.Errorf("field testGroups in DaeadTestSchemaV1Json: required")1082 }1083 type Plain DaeadTestSchemaV1Json1084 var plain Plain1085 if err := json.Unmarshal(value, &plain); err != nil {1086 return err1087 }1088 *j = DaeadTestSchemaV1Json(plain)1089 return nil1090}10911092type DaeadTestVector struct {1093 // additional authenticated data1094 Aad string `json:"aad"`10951096 // A brief description of the test case1097 Comment string `json:"comment"`10981099 // the ciphertext including tag1100 Ct string `json:"ct"`11011102 // A list of flags1103 Flags []string `json:"flags,omitempty,omitzero"`11041105 // the key1106 Key string `json:"key"`11071108 // the plaintext1109 Msg string `json:"msg"`11101111 // Result corresponds to the JSON schema field "result".1112 Result Result `json:"result"`11131114 // Identifier of the test case1115 TcId int `json:"tcId"`1116}11171118// UnmarshalJSON implements json.Unmarshaler.1119func (j *DaeadTestVector) UnmarshalJSON(value []byte) error {1120 var raw map[string]interface{}1121 if err := json.Unmarshal(value, &raw); err != nil {1122 return err1123 }1124 if _, ok := raw["aad"]; raw != nil && !ok {1125 return fmt.Errorf("field aad in DaeadTestVector: required")1126 }1127 if _, ok := raw["comment"]; raw != nil && !ok {1128 return fmt.Errorf("field comment in DaeadTestVector: required")1129 }1130 if _, ok := raw["ct"]; raw != nil && !ok {1131 return fmt.Errorf("field ct in DaeadTestVector: required")1132 }1133 if _, ok := raw["key"]; raw != nil && !ok {1134 return fmt.Errorf("field key in DaeadTestVector: required")1135 }1136 if _, ok := raw["msg"]; raw != nil && !ok {1137 return fmt.Errorf("field msg in DaeadTestVector: required")1138 }1139 if _, ok := raw["result"]; raw != nil && !ok {1140 return fmt.Errorf("field result in DaeadTestVector: required")1141 }1142 if _, ok := raw["tcId"]; raw != nil && !ok {1143 return fmt.Errorf("field tcId in DaeadTestVector: required")1144 }1145 type Plain DaeadTestVector1146 var plain Plain1147 if err := json.Unmarshal(value, &plain); err != nil {1148 return err1149 }1150 *j = DaeadTestVector(plain)1151 return nil1152}11531154type DsaP1363TestGroup struct {1155 // unencoded EC public key1156 PublicKey DsaPublicKey `json:"publicKey"`11571158 // DER encoded public key1159 PublicKeyDer string `json:"publicKeyDer"`11601161 // Pem encoded public key1162 PublicKeyPem string `json:"publicKeyPem"`11631164 // the hash function used for DSA1165 Sha string `json:"sha"`11661167 // Source corresponds to the JSON schema field "source".1168 Source Source `json:"source"`11691170 // Tests corresponds to the JSON schema field "tests".1171 Tests []SignatureTestVector `json:"tests"`11721173 // Type corresponds to the JSON schema field "type".1174 Type DsaP1363TestGroupType `json:"type"`1175}11761177type DsaP1363TestGroupType string11781179const DsaP1363TestGroupTypeDsaP1363Verify DsaP1363TestGroupType = "DsaP1363Verify"11801181var enumValues_DsaP1363TestGroupType = []interface{}{1182 "DsaP1363Verify",1183}11841185// UnmarshalJSON implements json.Unmarshaler.1186func (j *DsaP1363TestGroupType) UnmarshalJSON(value []byte) error {1187 var v string1188 if err := json.Unmarshal(value, &v); err != nil {1189 return err1190 }1191 var ok bool1192 for _, expected := range enumValues_DsaP1363TestGroupType {1193 if reflect.DeepEqual(v, expected) {1194 ok = true1195 break1196 }1197 }1198 if !ok {1199 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DsaP1363TestGroupType, v)1200 }1201 *j = DsaP1363TestGroupType(v)1202 return nil1203}12041205// UnmarshalJSON implements json.Unmarshaler.1206func (j *DsaP1363TestGroup) UnmarshalJSON(value []byte) error {1207 var raw map[string]interface{}1208 if err := json.Unmarshal(value, &raw); err != nil {1209 return err1210 }1211 if _, ok := raw["publicKey"]; raw != nil && !ok {1212 return fmt.Errorf("field publicKey in DsaP1363TestGroup: required")1213 }1214 if _, ok := raw["publicKeyDer"]; raw != nil && !ok {1215 return fmt.Errorf("field publicKeyDer in DsaP1363TestGroup: required")1216 }1217 if _, ok := raw["publicKeyPem"]; raw != nil && !ok {1218 return fmt.Errorf("field publicKeyPem in DsaP1363TestGroup: required")1219 }1220 if _, ok := raw["sha"]; raw != nil && !ok {1221 return fmt.Errorf("field sha in DsaP1363TestGroup: required")1222 }1223 if _, ok := raw["source"]; raw != nil && !ok {1224 return fmt.Errorf("field source in DsaP1363TestGroup: required")1225 }1226 if _, ok := raw["tests"]; raw != nil && !ok {1227 return fmt.Errorf("field tests in DsaP1363TestGroup: required")1228 }1229 if _, ok := raw["type"]; raw != nil && !ok {1230 return fmt.Errorf("field type in DsaP1363TestGroup: required")1231 }1232 type Plain DsaP1363TestGroup1233 var plain Plain1234 if err := json.Unmarshal(value, &plain); err != nil {1235 return err1236 }1237 *j = DsaP1363TestGroup(plain)1238 return nil1239}12401241type DsaP1363VerifySchemaV1Json struct {1242 // the primitive tested in the test file1243 Algorithm string `json:"algorithm"`12441245 // DEPRECATED: prefer "source" property in test group1246 GeneratorVersion *string `json:"generatorVersion,omitempty,omitzero"`12471248 // additional documentation1249 Header []string `json:"header"`12501251 // Notes corresponds to the JSON schema field "notes".1252 Notes Notes `json:"notes"`12531254 // the number of test vectors in this test1255 NumberOfTests int `json:"numberOfTests"`12561257 // Schema corresponds to the JSON schema field "schema".1258 Schema DsaP1363VerifySchemaV1JsonSchema `json:"schema"`12591260 // TestGroups corresponds to the JSON schema field "testGroups".1261 TestGroups []DsaP1363TestGroup `json:"testGroups"`1262}12631264type DsaP1363VerifySchemaV1JsonSchema string12651266const DsaP1363VerifySchemaV1JsonSchemaDsaP1363VerifySchemaV1Json DsaP1363VerifySchemaV1JsonSchema = "dsa_p1363_verify_schema_v1.json"12671268var enumValues_DsaP1363VerifySchemaV1JsonSchema = []interface{}{1269 "dsa_p1363_verify_schema_v1.json",1270}12711272// UnmarshalJSON implements json.Unmarshaler.1273func (j *DsaP1363VerifySchemaV1JsonSchema) UnmarshalJSON(value []byte) error {1274 var v string1275 if err := json.Unmarshal(value, &v); err != nil {1276 return err1277 }1278 var ok bool1279 for _, expected := range enumValues_DsaP1363VerifySchemaV1JsonSchema {1280 if reflect.DeepEqual(v, expected) {1281 ok = true1282 break1283 }1284 }1285 if !ok {1286 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DsaP1363VerifySchemaV1JsonSchema, v)1287 }1288 *j = DsaP1363VerifySchemaV1JsonSchema(v)1289 return nil1290}12911292// UnmarshalJSON implements json.Unmarshaler.1293func (j *DsaP1363VerifySchemaV1Json) UnmarshalJSON(value []byte) error {1294 var raw map[string]interface{}1295 if err := json.Unmarshal(value, &raw); err != nil {1296 return err1297 }1298 if _, ok := raw["algorithm"]; raw != nil && !ok {1299 return fmt.Errorf("field algorithm in DsaP1363VerifySchemaV1Json: required")1300 }1301 if _, ok := raw["header"]; raw != nil && !ok {1302 return fmt.Errorf("field header in DsaP1363VerifySchemaV1Json: required")1303 }1304 if _, ok := raw["notes"]; raw != nil && !ok {1305 return fmt.Errorf("field notes in DsaP1363VerifySchemaV1Json: required")1306 }1307 if _, ok := raw["numberOfTests"]; raw != nil && !ok {1308 return fmt.Errorf("field numberOfTests in DsaP1363VerifySchemaV1Json: required")1309 }1310 if _, ok := raw["schema"]; raw != nil && !ok {1311 return fmt.Errorf("field schema in DsaP1363VerifySchemaV1Json: required")1312 }1313 if _, ok := raw["testGroups"]; raw != nil && !ok {1314 return fmt.Errorf("field testGroups in DsaP1363VerifySchemaV1Json: required")1315 }1316 type Plain DsaP1363VerifySchemaV1Json1317 var plain Plain1318 if err := json.Unmarshal(value, &plain); err != nil {1319 return err1320 }1321 *j = DsaP1363VerifySchemaV1Json(plain)1322 return nil1323}13241325type DsaPublicKey struct {1326 // the generator of the multiplicative subgroup1327 G string `json:"g"`13281329 // the key size in bits1330 KeySize int `json:"keySize"`13311332 // the modulus p1333 P string `json:"p"`13341335 // the order of the generator g1336 Q string `json:"q"`13371338 // the key type1339 Type DsaPublicKeyType `json:"type"`13401341 // the public key value1342 Y string `json:"y"`1343}13441345type DsaPublicKeyType string13461347const DsaPublicKeyTypeDsaPublicKey DsaPublicKeyType = "DsaPublicKey"13481349var enumValues_DsaPublicKeyType = []interface{}{1350 "DsaPublicKey",1351}13521353// UnmarshalJSON implements json.Unmarshaler.1354func (j *DsaPublicKeyType) UnmarshalJSON(value []byte) error {1355 var v string1356 if err := json.Unmarshal(value, &v); err != nil {1357 return err1358 }1359 var ok bool1360 for _, expected := range enumValues_DsaPublicKeyType {1361 if reflect.DeepEqual(v, expected) {1362 ok = true1363 break1364 }1365 }1366 if !ok {1367 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DsaPublicKeyType, v)1368 }1369 *j = DsaPublicKeyType(v)1370 return nil1371}13721373// UnmarshalJSON implements json.Unmarshaler.1374func (j *DsaPublicKey) UnmarshalJSON(value []byte) error {1375 var raw map[string]interface{}1376 if err := json.Unmarshal(value, &raw); err != nil {1377 return err1378 }1379 if _, ok := raw["g"]; raw != nil && !ok {1380 return fmt.Errorf("field g in DsaPublicKey: required")1381 }1382 if _, ok := raw["keySize"]; raw != nil && !ok {1383 return fmt.Errorf("field keySize in DsaPublicKey: required")1384 }1385 if _, ok := raw["p"]; raw != nil && !ok {1386 return fmt.Errorf("field p in DsaPublicKey: required")1387 }1388 if _, ok := raw["q"]; raw != nil && !ok {1389 return fmt.Errorf("field q in DsaPublicKey: required")1390 }1391 if _, ok := raw["type"]; raw != nil && !ok {1392 return fmt.Errorf("field type in DsaPublicKey: required")1393 }1394 if _, ok := raw["y"]; raw != nil && !ok {1395 return fmt.Errorf("field y in DsaPublicKey: required")1396 }1397 type Plain DsaPublicKey1398 var plain Plain1399 if err := json.Unmarshal(value, &plain); err != nil {1400 return err1401 }1402 *j = DsaPublicKey(plain)1403 return nil1404}14051406type DsaTestGroup struct {1407 // unenocded DSA public key1408 PublicKey DsaPublicKey `json:"publicKey"`14091410 // DER encoded public key1411 PublicKeyDer string `json:"publicKeyDer"`14121413 // Pem encoded public key1414 PublicKeyPem string `json:"publicKeyPem"`14151416 // the hash function used for DSA1417 Sha string `json:"sha"`14181419 // Source corresponds to the JSON schema field "source".1420 Source Source `json:"source"`14211422 // Tests corresponds to the JSON schema field "tests".1423 Tests []AsnSignatureTestVector `json:"tests"`14241425 // Type corresponds to the JSON schema field "type".1426 Type DsaTestGroupType `json:"type"`1427}14281429type DsaTestGroupType string14301431const DsaTestGroupTypeDsaVerify DsaTestGroupType = "DsaVerify"14321433var enumValues_DsaTestGroupType = []interface{}{1434 "DsaVerify",1435}14361437// UnmarshalJSON implements json.Unmarshaler.1438func (j *DsaTestGroupType) UnmarshalJSON(value []byte) error {1439 var v string1440 if err := json.Unmarshal(value, &v); err != nil {1441 return err1442 }1443 var ok bool1444 for _, expected := range enumValues_DsaTestGroupType {1445 if reflect.DeepEqual(v, expected) {1446 ok = true1447 break1448 }1449 }1450 if !ok {1451 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DsaTestGroupType, v)1452 }1453 *j = DsaTestGroupType(v)1454 return nil1455}14561457// UnmarshalJSON implements json.Unmarshaler.1458func (j *DsaTestGroup) UnmarshalJSON(value []byte) error {1459 var raw map[string]interface{}1460 if err := json.Unmarshal(value, &raw); err != nil {1461 return err1462 }1463 if _, ok := raw["publicKey"]; raw != nil && !ok {1464 return fmt.Errorf("field publicKey in DsaTestGroup: required")1465 }1466 if _, ok := raw["publicKeyDer"]; raw != nil && !ok {1467 return fmt.Errorf("field publicKeyDer in DsaTestGroup: required")1468 }1469 if _, ok := raw["publicKeyPem"]; raw != nil && !ok {1470 return fmt.Errorf("field publicKeyPem in DsaTestGroup: required")1471 }1472 if _, ok := raw["sha"]; raw != nil && !ok {1473 return fmt.Errorf("field sha in DsaTestGroup: required")1474 }1475 if _, ok := raw["source"]; raw != nil && !ok {1476 return fmt.Errorf("field source in DsaTestGroup: required")1477 }1478 if _, ok := raw["tests"]; raw != nil && !ok {1479 return fmt.Errorf("field tests in DsaTestGroup: required")1480 }1481 if _, ok := raw["type"]; raw != nil && !ok {1482 return fmt.Errorf("field type in DsaTestGroup: required")1483 }1484 type Plain DsaTestGroup1485 var plain Plain1486 if err := json.Unmarshal(value, &plain); err != nil {1487 return err1488 }1489 *j = DsaTestGroup(plain)1490 return nil1491}14921493type DsaVerifySchemaV1Json struct {1494 // the primitive tested in the test file1495 Algorithm string `json:"algorithm"`14961497 // DEPRECATED: prefer "source" property in test group1498 GeneratorVersion *string `json:"generatorVersion,omitempty,omitzero"`14991500 // additional documentation1501 Header []string `json:"header"`15021503 // Notes corresponds to the JSON schema field "notes".1504 Notes Notes `json:"notes"`15051506 // the number of test vectors in this test1507 NumberOfTests int `json:"numberOfTests"`15081509 // Schema corresponds to the JSON schema field "schema".1510 Schema DsaVerifySchemaV1JsonSchema `json:"schema"`15111512 // TestGroups corresponds to the JSON schema field "testGroups".1513 TestGroups []DsaTestGroup `json:"testGroups"`1514}15151516type DsaVerifySchemaV1JsonSchema string15171518const DsaVerifySchemaV1JsonSchemaDsaVerifySchemaV1Json DsaVerifySchemaV1JsonSchema = "dsa_verify_schema_v1.json"15191520var enumValues_DsaVerifySchemaV1JsonSchema = []interface{}{1521 "dsa_verify_schema_v1.json",1522}15231524// UnmarshalJSON implements json.Unmarshaler.1525func (j *DsaVerifySchemaV1JsonSchema) UnmarshalJSON(value []byte) error {1526 var v string1527 if err := json.Unmarshal(value, &v); err != nil {1528 return err1529 }1530 var ok bool1531 for _, expected := range enumValues_DsaVerifySchemaV1JsonSchema {1532 if reflect.DeepEqual(v, expected) {1533 ok = true1534 break1535 }1536 }1537 if !ok {1538 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DsaVerifySchemaV1JsonSchema, v)1539 }1540 *j = DsaVerifySchemaV1JsonSchema(v)1541 return nil1542}15431544// UnmarshalJSON implements json.Unmarshaler.1545func (j *DsaVerifySchemaV1Json) UnmarshalJSON(value []byte) error {1546 var raw map[string]interface{}1547 if err := json.Unmarshal(value, &raw); err != nil {1548 return err1549 }1550 if _, ok := raw["algorithm"]; raw != nil && !ok {1551 return fmt.Errorf("field algorithm in DsaVerifySchemaV1Json: required")1552 }1553 if _, ok := raw["header"]; raw != nil && !ok {1554 return fmt.Errorf("field header in DsaVerifySchemaV1Json: required")1555 }1556 if _, ok := raw["notes"]; raw != nil && !ok {1557 return fmt.Errorf("field notes in DsaVerifySchemaV1Json: required")1558 }1559 if _, ok := raw["numberOfTests"]; raw != nil && !ok {1560 return fmt.Errorf("field numberOfTests in DsaVerifySchemaV1Json: required")1561 }1562 if _, ok := raw["schema"]; raw != nil && !ok {1563 return fmt.Errorf("field schema in DsaVerifySchemaV1Json: required")1564 }1565 if _, ok := raw["testGroups"]; raw != nil && !ok {1566 return fmt.Errorf("field testGroups in DsaVerifySchemaV1Json: required")1567 }1568 type Plain DsaVerifySchemaV1Json1569 var plain Plain1570 if err := json.Unmarshal(value, &plain); err != nil {1571 return err1572 }1573 *j = DsaVerifySchemaV1Json(plain)1574 return nil1575}15761577// A test for checking elliptic curve domain parameters.1578type EcCurveTest struct {1579 // Source corresponds to the JSON schema field "source".1580 Source Source `json:"source"`15811582 // Tests corresponds to the JSON schema field "tests".1583 Tests []EcCurveTestTestsElem `json:"tests"`15841585 // Type corresponds to the JSON schema field "type".1586 Type EcCurveTestType `json:"type"`1587}15881589type EcCurveTestSchemaJson struct {1590 // Algorithm corresponds to the JSON schema field "algorithm".1591 Algorithm EcCurveTestSchemaJsonAlgorithm `json:"algorithm"`15921593 // DEPRECATED: prefer "source" property in test group1594 GeneratorVersion *string `json:"generatorVersion,omitempty,omitzero"`15951596 // additional documentation1597 Header []string `json:"header"`15981599 // Notes corresponds to the JSON schema field "notes".1600 Notes Notes `json:"notes"`16011602 // the number of test vectors in this test1603 NumberOfTests int `json:"numberOfTests"`16041605 // Schema corresponds to the JSON schema field "schema".1606 Schema EcCurveTestSchemaJsonSchema `json:"schema"`16071608 // TestGroups corresponds to the JSON schema field "testGroups".1609 TestGroups []EcCurveTest `json:"testGroups"`1610}16111612type EcCurveTestSchemaJsonAlgorithm string16131614const EcCurveTestSchemaJsonAlgorithmEcCurveTest EcCurveTestSchemaJsonAlgorithm = "EcCurveTest"16151616var enumValues_EcCurveTestSchemaJsonAlgorithm = []interface{}{1617 "EcCurveTest",1618}16191620// UnmarshalJSON implements json.Unmarshaler.1621func (j *EcCurveTestSchemaJsonAlgorithm) UnmarshalJSON(value []byte) error {1622 var v string1623 if err := json.Unmarshal(value, &v); err != nil {1624 return err1625 }1626 var ok bool1627 for _, expected := range enumValues_EcCurveTestSchemaJsonAlgorithm {1628 if reflect.DeepEqual(v, expected) {1629 ok = true1630 break1631 }1632 }1633 if !ok {1634 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcCurveTestSchemaJsonAlgorithm, v)1635 }1636 *j = EcCurveTestSchemaJsonAlgorithm(v)1637 return nil1638}16391640type EcCurveTestSchemaJsonSchema string16411642const EcCurveTestSchemaJsonSchemaEcCurveTestSchemaJson EcCurveTestSchemaJsonSchema = "ec_curve_test_schema.json"16431644var enumValues_EcCurveTestSchemaJsonSchema = []interface{}{1645 "ec_curve_test_schema.json",1646}16471648// UnmarshalJSON implements json.Unmarshaler.1649func (j *EcCurveTestSchemaJsonSchema) UnmarshalJSON(value []byte) error {1650 var v string1651 if err := json.Unmarshal(value, &v); err != nil {1652 return err1653 }1654 var ok bool1655 for _, expected := range enumValues_EcCurveTestSchemaJsonSchema {1656 if reflect.DeepEqual(v, expected) {1657 ok = true1658 break1659 }1660 }1661 if !ok {1662 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcCurveTestSchemaJsonSchema, v)1663 }1664 *j = EcCurveTestSchemaJsonSchema(v)1665 return nil1666}16671668// UnmarshalJSON implements json.Unmarshaler.1669func (j *EcCurveTestSchemaJson) UnmarshalJSON(value []byte) error {1670 var raw map[string]interface{}1671 if err := json.Unmarshal(value, &raw); err != nil {1672 return err1673 }1674 if _, ok := raw["algorithm"]; raw != nil && !ok {1675 return fmt.Errorf("field algorithm in EcCurveTestSchemaJson: required")1676 }1677 if _, ok := raw["header"]; raw != nil && !ok {1678 return fmt.Errorf("field header in EcCurveTestSchemaJson: required")1679 }1680 if _, ok := raw["notes"]; raw != nil && !ok {1681 return fmt.Errorf("field notes in EcCurveTestSchemaJson: required")1682 }1683 if _, ok := raw["numberOfTests"]; raw != nil && !ok {1684 return fmt.Errorf("field numberOfTests in EcCurveTestSchemaJson: required")1685 }1686 if _, ok := raw["schema"]; raw != nil && !ok {1687 return fmt.Errorf("field schema in EcCurveTestSchemaJson: required")1688 }1689 if _, ok := raw["testGroups"]; raw != nil && !ok {1690 return fmt.Errorf("field testGroups in EcCurveTestSchemaJson: required")1691 }1692 type Plain EcCurveTestSchemaJson1693 var plain Plain1694 if err := json.Unmarshal(value, &plain); err != nil {1695 return err1696 }1697 *j = EcCurveTestSchemaJson(plain)1698 return nil1699}17001701type EcCurveTestTestsElem struct {1702 // Coefficient a of the curve's Weierstrass equation1703 A string `json:"a"`17041705 // Coefficient b of the curve's Weierstrass equation1706 B string `json:"b"`17071708 // A brief description of the test case1709 Comment *string `json:"comment,omitempty,omitzero"`17101711 // A list of flags1712 Flags []string `json:"flags,omitempty,omitzero"`17131714 // x coordinate of the curve's generator1715 Gx string `json:"gx"`17161717 // y coordinate of the curve's generator1718 Gy string `json:"gy"`17191720 // Cofactor of the curve1721 H int `json:"h"`17221723 // Order of the curve1724 N string `json:"n"`17251726 // Name identifying the elliptic curve1727 Name *string `json:"name,omitempty,omitzero"`17281729 // Object identifier of the ellptic curve1730 Oid string `json:"oid"`17311732 // Prime identifying the field of definition1733 P string `json:"p"`17341735 // Standard containing the domain parameters1736 Ref *string `json:"ref,omitempty,omitzero"`17371738 // Result corresponds to the JSON schema field "result".1739 Result Result `json:"result"`17401741 // Identifier of the test case1742 TcId int `json:"tcId"`1743}17441745// UnmarshalJSON implements json.Unmarshaler.1746func (j *EcCurveTestTestsElem) UnmarshalJSON(value []byte) error {1747 var raw map[string]interface{}1748 if err := json.Unmarshal(value, &raw); err != nil {1749 return err1750 }1751 if _, ok := raw["a"]; raw != nil && !ok {1752 return fmt.Errorf("field a in EcCurveTestTestsElem: required")1753 }1754 if _, ok := raw["b"]; raw != nil && !ok {1755 return fmt.Errorf("field b in EcCurveTestTestsElem: required")1756 }1757 if _, ok := raw["gx"]; raw != nil && !ok {1758 return fmt.Errorf("field gx in EcCurveTestTestsElem: required")1759 }1760 if _, ok := raw["gy"]; raw != nil && !ok {1761 return fmt.Errorf("field gy in EcCurveTestTestsElem: required")1762 }1763 if _, ok := raw["h"]; raw != nil && !ok {1764 return fmt.Errorf("field h in EcCurveTestTestsElem: required")1765 }1766 if _, ok := raw["n"]; raw != nil && !ok {1767 return fmt.Errorf("field n in EcCurveTestTestsElem: required")1768 }1769 if _, ok := raw["oid"]; raw != nil && !ok {1770 return fmt.Errorf("field oid in EcCurveTestTestsElem: required")1771 }1772 if _, ok := raw["p"]; raw != nil && !ok {1773 return fmt.Errorf("field p in EcCurveTestTestsElem: required")1774 }1775 if _, ok := raw["result"]; raw != nil && !ok {1776 return fmt.Errorf("field result in EcCurveTestTestsElem: required")1777 }1778 if _, ok := raw["tcId"]; raw != nil && !ok {1779 return fmt.Errorf("field tcId in EcCurveTestTestsElem: required")1780 }1781 type Plain EcCurveTestTestsElem1782 var plain Plain1783 if err := json.Unmarshal(value, &plain); err != nil {1784 return err1785 }1786 *j = EcCurveTestTestsElem(plain)1787 return nil1788}17891790type EcCurveTestType string17911792const EcCurveTestTypeEcCurveTest EcCurveTestType = "EcCurveTest"17931794var enumValues_EcCurveTestType = []interface{}{1795 "EcCurveTest",1796}17971798// UnmarshalJSON implements json.Unmarshaler.1799func (j *EcCurveTestType) UnmarshalJSON(value []byte) error {1800 var v string1801 if err := json.Unmarshal(value, &v); err != nil {1802 return err1803 }1804 var ok bool1805 for _, expected := range enumValues_EcCurveTestType {1806 if reflect.DeepEqual(v, expected) {1807 ok = true1808 break1809 }1810 }1811 if !ok {1812 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcCurveTestType, v)1813 }1814 *j = EcCurveTestType(v)1815 return nil1816}18171818// UnmarshalJSON implements json.Unmarshaler.1819func (j *EcCurveTest) UnmarshalJSON(value []byte) error {1820 var raw map[string]interface{}1821 if err := json.Unmarshal(value, &raw); err != nil {1822 return err1823 }1824 if _, ok := raw["source"]; raw != nil && !ok {1825 return fmt.Errorf("field source in EcCurveTest: required")1826 }1827 if _, ok := raw["tests"]; raw != nil && !ok {1828 return fmt.Errorf("field tests in EcCurveTest: required")1829 }1830 if _, ok := raw["type"]; raw != nil && !ok {1831 return fmt.Errorf("field type in EcCurveTest: required")1832 }1833 type Plain EcCurveTest1834 var plain Plain1835 if err := json.Unmarshal(value, &plain); err != nil {1836 return err1837 }1838 *j = EcCurveTest(plain)1839 return nil1840}18411842type EcPublicKey struct {1843 // the EC group used by this public key1844 Curve string `json:"curve"`18451846 // the key size in bits1847 KeySize int `json:"keySize"`18481849 // the key type1850 Type EcPublicKeyType `json:"type"`18511852 // encoded public key point1853 Uncompressed string `json:"uncompressed"`18541855 // the x-coordinate of the public key point1856 Wx string `json:"wx"`18571858 // the y-coordinate of the public key point1859 Wy string `json:"wy"`1860}18611862type EcPublicKeyType string18631864const EcPublicKeyTypeEcPublicKey EcPublicKeyType = "EcPublicKey"18651866var enumValues_EcPublicKeyType = []interface{}{1867 "EcPublicKey",1868}18691870// UnmarshalJSON implements json.Unmarshaler.1871func (j *EcPublicKeyType) UnmarshalJSON(value []byte) error {1872 var v string1873 if err := json.Unmarshal(value, &v); err != nil {1874 return err1875 }1876 var ok bool1877 for _, expected := range enumValues_EcPublicKeyType {1878 if reflect.DeepEqual(v, expected) {1879 ok = true1880 break1881 }1882 }1883 if !ok {1884 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcPublicKeyType, v)1885 }1886 *j = EcPublicKeyType(v)1887 return nil1888}18891890// UnmarshalJSON implements json.Unmarshaler.1891func (j *EcPublicKey) UnmarshalJSON(value []byte) error {1892 var raw map[string]interface{}1893 if err := json.Unmarshal(value, &raw); err != nil {1894 return err1895 }1896 if _, ok := raw["curve"]; raw != nil && !ok {1897 return fmt.Errorf("field curve in EcPublicKey: required")1898 }1899 if _, ok := raw["keySize"]; raw != nil && !ok {1900 return fmt.Errorf("field keySize in EcPublicKey: required")1901 }1902 if _, ok := raw["type"]; raw != nil && !ok {1903 return fmt.Errorf("field type in EcPublicKey: required")1904 }1905 if _, ok := raw["uncompressed"]; raw != nil && !ok {1906 return fmt.Errorf("field uncompressed in EcPublicKey: required")1907 }1908 if _, ok := raw["wx"]; raw != nil && !ok {1909 return fmt.Errorf("field wx in EcPublicKey: required")1910 }1911 if _, ok := raw["wy"]; raw != nil && !ok {1912 return fmt.Errorf("field wy in EcPublicKey: required")1913 }1914 type Plain EcPublicKey1915 var plain Plain1916 if err := json.Unmarshal(value, &plain); err != nil {1917 return err1918 }1919 *j = EcPublicKey(plain)1920 return nil1921}19221923type EcdhEcpointTestGroup struct {1924 // the name of the curve1925 Curve string `json:"curve"`19261927 // the encoding of the public key1928 Encoding string `json:"encoding"`19291930 // Source corresponds to the JSON schema field "source".1931 Source Source `json:"source"`19321933 // Tests corresponds to the JSON schema field "tests".1934 Tests []EcdhEcpointTestVector `json:"tests"`19351936 // Type corresponds to the JSON schema field "type".1937 Type EcdhEcpointTestGroupType `json:"type"`1938}19391940type EcdhEcpointTestGroupType string19411942const EcdhEcpointTestGroupTypeEcdhEcpointTest EcdhEcpointTestGroupType = "EcdhEcpointTest"19431944var enumValues_EcdhEcpointTestGroupType = []interface{}{1945 "EcdhEcpointTest",1946}19471948// UnmarshalJSON implements json.Unmarshaler.1949func (j *EcdhEcpointTestGroupType) UnmarshalJSON(value []byte) error {1950 var v string1951 if err := json.Unmarshal(value, &v); err != nil {1952 return err1953 }1954 var ok bool1955 for _, expected := range enumValues_EcdhEcpointTestGroupType {1956 if reflect.DeepEqual(v, expected) {1957 ok = true1958 break1959 }1960 }1961 if !ok {1962 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcdhEcpointTestGroupType, v)1963 }1964 *j = EcdhEcpointTestGroupType(v)1965 return nil1966}19671968// UnmarshalJSON implements json.Unmarshaler.1969func (j *EcdhEcpointTestGroup) UnmarshalJSON(value []byte) error {1970 var raw map[string]interface{}1971 if err := json.Unmarshal(value, &raw); err != nil {1972 return err1973 }1974 if _, ok := raw["curve"]; raw != nil && !ok {1975 return fmt.Errorf("field curve in EcdhEcpointTestGroup: required")1976 }1977 if _, ok := raw["encoding"]; raw != nil && !ok {1978 return fmt.Errorf("field encoding in EcdhEcpointTestGroup: required")1979 }1980 if _, ok := raw["source"]; raw != nil && !ok {1981 return fmt.Errorf("field source in EcdhEcpointTestGroup: required")1982 }1983 if _, ok := raw["tests"]; raw != nil && !ok {1984 return fmt.Errorf("field tests in EcdhEcpointTestGroup: required")1985 }1986 if _, ok := raw["type"]; raw != nil && !ok {1987 return fmt.Errorf("field type in EcdhEcpointTestGroup: required")1988 }1989 type Plain EcdhEcpointTestGroup1990 var plain Plain1991 if err := json.Unmarshal(value, &plain); err != nil {1992 return err1993 }1994 *j = EcdhEcpointTestGroup(plain)1995 return nil1996}19971998type EcdhEcpointTestSchemaV1Json struct {1999 // the primitive tested in the test file2000 Algorithm string `json:"algorithm"`
Findings
✓ No findings reported for this file.