// Code generated by github.com/atombender/go-jsonschema, DO NOT EDIT. package wycheproof import "encoding/json" import "fmt" import "reflect" import "unicode/utf8" type AeadTestGroup struct { // the IV size in bits IvSize int `json:"ivSize"` // the keySize in bits KeySize int `json:"keySize"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // the expected size of the tag in bits TagSize int `json:"tagSize"` // Tests corresponds to the JSON schema field "tests". Tests []AeadTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type AeadTestGroupType `json:"type"` } type AeadTestGroupType string const AeadTestGroupTypeAeadTest AeadTestGroupType = "AeadTest" var enumValues_AeadTestGroupType = []interface{}{ "AeadTest", } // UnmarshalJSON implements json.Unmarshaler. func (j *AeadTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_AeadTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AeadTestGroupType, v) } *j = AeadTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *AeadTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["ivSize"]; raw != nil && !ok { return fmt.Errorf("field ivSize in AeadTestGroup: required") } if _, ok := raw["keySize"]; raw != nil && !ok { return fmt.Errorf("field keySize in AeadTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in AeadTestGroup: required") } if _, ok := raw["tagSize"]; raw != nil && !ok { return fmt.Errorf("field tagSize in AeadTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in AeadTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in AeadTestGroup: required") } type Plain AeadTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = AeadTestGroup(plain) return nil } type AeadTestSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema AeadTestSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []AeadTestGroup `json:"testGroups"` } type AeadTestSchemaV1JsonSchema string const AeadTestSchemaV1JsonSchemaAeadTestSchemaV1Json AeadTestSchemaV1JsonSchema = "aead_test_schema_v1.json" var enumValues_AeadTestSchemaV1JsonSchema = []interface{}{ "aead_test_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *AeadTestSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_AeadTestSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AeadTestSchemaV1JsonSchema, v) } *j = AeadTestSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *AeadTestSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in AeadTestSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in AeadTestSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in AeadTestSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in AeadTestSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in AeadTestSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in AeadTestSchemaV1Json: required") } type Plain AeadTestSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = AeadTestSchemaV1Json(plain) return nil } type AeadTestVector struct { // additional authenticated data Aad string `json:"aad"` // A brief description of the test case Comment string `json:"comment"` // the ciphertext (without iv and tag) Ct string `json:"ct"` // A list of flags Flags []string `json:"flags"` // the nonce Iv string `json:"iv"` // the key Key string `json:"key"` // the plaintext Msg string `json:"msg"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // the authentication tag Tag string `json:"tag"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *AeadTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["aad"]; raw != nil && !ok { return fmt.Errorf("field aad in AeadTestVector: required") } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in AeadTestVector: required") } if _, ok := raw["ct"]; raw != nil && !ok { return fmt.Errorf("field ct in AeadTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in AeadTestVector: required") } if _, ok := raw["iv"]; raw != nil && !ok { return fmt.Errorf("field iv in AeadTestVector: required") } if _, ok := raw["key"]; raw != nil && !ok { return fmt.Errorf("field key in AeadTestVector: required") } if _, ok := raw["msg"]; raw != nil && !ok { return fmt.Errorf("field msg in AeadTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in AeadTestVector: required") } if _, ok := raw["tag"]; raw != nil && !ok { return fmt.Errorf("field tag in AeadTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in AeadTestVector: required") } type Plain AeadTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = AeadTestVector(plain) return nil } type AsnSignatureTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // The message to sign Msg string `json:"msg"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // An ASN encoded signature for msg Sig string `json:"sig"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *AsnSignatureTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in AsnSignatureTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in AsnSignatureTestVector: required") } if _, ok := raw["msg"]; raw != nil && !ok { return fmt.Errorf("field msg in AsnSignatureTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in AsnSignatureTestVector: required") } if _, ok := raw["sig"]; raw != nil && !ok { return fmt.Errorf("field sig in AsnSignatureTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in AsnSignatureTestVector: required") } type Plain AsnSignatureTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = AsnSignatureTestVector(plain) return nil } type BlsAggregateVerifySchemaJson struct { // The primitive tested in the test file Algorithm string `json:"algorithm"` // Additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // The number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema BlsAggregateVerifySchemaJsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []BlsAggregateVerifyTestGroup `json:"testGroups"` } type BlsAggregateVerifySchemaJsonSchema string const BlsAggregateVerifySchemaJsonSchemaBlsAggregateVerifySchemaJson BlsAggregateVerifySchemaJsonSchema = "bls_aggregate_verify_schema.json" var enumValues_BlsAggregateVerifySchemaJsonSchema = []interface{}{ "bls_aggregate_verify_schema.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *BlsAggregateVerifySchemaJsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_BlsAggregateVerifySchemaJsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BlsAggregateVerifySchemaJsonSchema, v) } *j = BlsAggregateVerifySchemaJsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *BlsAggregateVerifySchemaJson) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in BlsAggregateVerifySchemaJson: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in BlsAggregateVerifySchemaJson: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in BlsAggregateVerifySchemaJson: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in BlsAggregateVerifySchemaJson: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in BlsAggregateVerifySchemaJson: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in BlsAggregateVerifySchemaJson: required") } type Plain BlsAggregateVerifySchemaJson var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = BlsAggregateVerifySchemaJson(plain) return nil } type BlsAggregateVerifyTestGroup struct { // The BLS ciphersuite identifier Ciphersuite string `json:"ciphersuite"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []BlsAggregateVerifyTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type BlsAggregateVerifyTestGroupType `json:"type"` } type BlsAggregateVerifyTestGroupType string const BlsAggregateVerifyTestGroupTypeBlsAggregateVerify BlsAggregateVerifyTestGroupType = "BlsAggregateVerify" var enumValues_BlsAggregateVerifyTestGroupType = []interface{}{ "BlsAggregateVerify", } // UnmarshalJSON implements json.Unmarshaler. func (j *BlsAggregateVerifyTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_BlsAggregateVerifyTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BlsAggregateVerifyTestGroupType, v) } *j = BlsAggregateVerifyTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *BlsAggregateVerifyTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["ciphersuite"]; raw != nil && !ok { return fmt.Errorf("field ciphersuite in BlsAggregateVerifyTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in BlsAggregateVerifyTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in BlsAggregateVerifyTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in BlsAggregateVerifyTestGroup: required") } type Plain BlsAggregateVerifyTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = BlsAggregateVerifyTestGroup(plain) return nil } type BlsAggregateVerifyTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // The messages that were signed Messages []string `json:"messages"` // The compressed public keys Pubkeys []string `json:"pubkeys"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // The aggregated BLS signature in compressed form Sig string `json:"sig"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *BlsAggregateVerifyTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in BlsAggregateVerifyTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in BlsAggregateVerifyTestVector: required") } if _, ok := raw["messages"]; raw != nil && !ok { return fmt.Errorf("field messages in BlsAggregateVerifyTestVector: required") } if _, ok := raw["pubkeys"]; raw != nil && !ok { return fmt.Errorf("field pubkeys in BlsAggregateVerifyTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in BlsAggregateVerifyTestVector: required") } if _, ok := raw["sig"]; raw != nil && !ok { return fmt.Errorf("field sig in BlsAggregateVerifyTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in BlsAggregateVerifyTestVector: required") } type Plain BlsAggregateVerifyTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = BlsAggregateVerifyTestVector(plain) return nil } type BlsHashToG2SchemaJson struct { // The primitive tested in the test file Algorithm string `json:"algorithm"` // Additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // The number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema BlsHashToG2SchemaJsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []BlsHashToG2TestGroup `json:"testGroups"` } type BlsHashToG2SchemaJsonSchema string const BlsHashToG2SchemaJsonSchemaBlsHashToG2SchemaJson BlsHashToG2SchemaJsonSchema = "bls_hash_to_g2_schema.json" var enumValues_BlsHashToG2SchemaJsonSchema = []interface{}{ "bls_hash_to_g2_schema.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *BlsHashToG2SchemaJsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_BlsHashToG2SchemaJsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BlsHashToG2SchemaJsonSchema, v) } *j = BlsHashToG2SchemaJsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *BlsHashToG2SchemaJson) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in BlsHashToG2SchemaJson: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in BlsHashToG2SchemaJson: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in BlsHashToG2SchemaJson: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in BlsHashToG2SchemaJson: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in BlsHashToG2SchemaJson: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in BlsHashToG2SchemaJson: required") } type Plain BlsHashToG2SchemaJson var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = BlsHashToG2SchemaJson(plain) return nil } type BlsHashToG2TestGroup struct { // The domain separation tag used for hash_to_curve Dst string `json:"dst"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []BlsHashToG2TestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type BlsHashToG2TestGroupType `json:"type"` } type BlsHashToG2TestGroupType string const BlsHashToG2TestGroupTypeBlsHashToG2 BlsHashToG2TestGroupType = "BlsHashToG2" var enumValues_BlsHashToG2TestGroupType = []interface{}{ "BlsHashToG2", } // UnmarshalJSON implements json.Unmarshaler. func (j *BlsHashToG2TestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_BlsHashToG2TestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BlsHashToG2TestGroupType, v) } *j = BlsHashToG2TestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *BlsHashToG2TestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["dst"]; raw != nil && !ok { return fmt.Errorf("field dst in BlsHashToG2TestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in BlsHashToG2TestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in BlsHashToG2TestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in BlsHashToG2TestGroup: required") } type Plain BlsHashToG2TestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = BlsHashToG2TestGroup(plain) return nil } type BlsHashToG2TestVector struct { // A brief description of the test case Comment string `json:"comment"` // The expected hash-to-curve output point in compressed form Expected string `json:"expected"` // A list of flags Flags []string `json:"flags"` // The input message Msg string `json:"msg"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *BlsHashToG2TestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in BlsHashToG2TestVector: required") } if _, ok := raw["expected"]; raw != nil && !ok { return fmt.Errorf("field expected in BlsHashToG2TestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in BlsHashToG2TestVector: required") } if _, ok := raw["msg"]; raw != nil && !ok { return fmt.Errorf("field msg in BlsHashToG2TestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in BlsHashToG2TestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in BlsHashToG2TestVector: required") } type Plain BlsHashToG2TestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = BlsHashToG2TestVector(plain) return nil } type BlsPublicKey struct { // The group the public key belongs to Group BlsPublicKeyGroup `json:"group"` // The size of the public key in bytes KeySize int `json:"keySize"` // The compressed public key Pk string `json:"pk"` } type BlsPublicKeyGroup string const BlsPublicKeyGroupG1 BlsPublicKeyGroup = "G1" const BlsPublicKeyGroupG2 BlsPublicKeyGroup = "G2" var enumValues_BlsPublicKeyGroup = []interface{}{ "G1", "G2", } // UnmarshalJSON implements json.Unmarshaler. func (j *BlsPublicKeyGroup) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_BlsPublicKeyGroup { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BlsPublicKeyGroup, v) } *j = BlsPublicKeyGroup(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *BlsPublicKey) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["group"]; raw != nil && !ok { return fmt.Errorf("field group in BlsPublicKey: required") } if _, ok := raw["keySize"]; raw != nil && !ok { return fmt.Errorf("field keySize in BlsPublicKey: required") } if _, ok := raw["pk"]; raw != nil && !ok { return fmt.Errorf("field pk in BlsPublicKey: required") } type Plain BlsPublicKey var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = BlsPublicKey(plain) return nil } type BlsSigVerifySchemaJson struct { // The primitive tested in the test file Algorithm string `json:"algorithm"` // Additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // The number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema BlsSigVerifySchemaJsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []BlsSigVerifyTestGroup `json:"testGroups"` } type BlsSigVerifySchemaJsonSchema string const BlsSigVerifySchemaJsonSchemaBlsSigVerifySchemaJson BlsSigVerifySchemaJsonSchema = "bls_sig_verify_schema.json" var enumValues_BlsSigVerifySchemaJsonSchema = []interface{}{ "bls_sig_verify_schema.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *BlsSigVerifySchemaJsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_BlsSigVerifySchemaJsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BlsSigVerifySchemaJsonSchema, v) } *j = BlsSigVerifySchemaJsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *BlsSigVerifySchemaJson) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in BlsSigVerifySchemaJson: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in BlsSigVerifySchemaJson: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in BlsSigVerifySchemaJson: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in BlsSigVerifySchemaJson: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in BlsSigVerifySchemaJson: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in BlsSigVerifySchemaJson: required") } type Plain BlsSigVerifySchemaJson var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = BlsSigVerifySchemaJson(plain) return nil } type BlsSigVerifyTestGroup struct { // The BLS ciphersuite identifier, e.g. // BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_ Ciphersuite string `json:"ciphersuite"` // PublicKey corresponds to the JSON schema field "publicKey". PublicKey BlsPublicKey `json:"publicKey"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []SignatureTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type BlsSigVerifyTestGroupType `json:"type"` } type BlsSigVerifyTestGroupType string const BlsSigVerifyTestGroupTypeBlsSigVerify BlsSigVerifyTestGroupType = "BlsSigVerify" var enumValues_BlsSigVerifyTestGroupType = []interface{}{ "BlsSigVerify", } // UnmarshalJSON implements json.Unmarshaler. func (j *BlsSigVerifyTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_BlsSigVerifyTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BlsSigVerifyTestGroupType, v) } *j = BlsSigVerifyTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *BlsSigVerifyTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["ciphersuite"]; raw != nil && !ok { return fmt.Errorf("field ciphersuite in BlsSigVerifyTestGroup: required") } if _, ok := raw["publicKey"]; raw != nil && !ok { return fmt.Errorf("field publicKey in BlsSigVerifyTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in BlsSigVerifyTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in BlsSigVerifyTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in BlsSigVerifyTestGroup: required") } type Plain BlsSigVerifyTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = BlsSigVerifyTestGroup(plain) return nil } type DaeadTestGroup struct { // the keySize in bits KeySize int `json:"keySize"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []DaeadTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type DaeadTestGroupType `json:"type"` } type DaeadTestGroupType string const DaeadTestGroupTypeDaeadTest DaeadTestGroupType = "DaeadTest" var enumValues_DaeadTestGroupType = []interface{}{ "DaeadTest", } // UnmarshalJSON implements json.Unmarshaler. func (j *DaeadTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_DaeadTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DaeadTestGroupType, v) } *j = DaeadTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *DaeadTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["keySize"]; raw != nil && !ok { return fmt.Errorf("field keySize in DaeadTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in DaeadTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in DaeadTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in DaeadTestGroup: required") } type Plain DaeadTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = DaeadTestGroup(plain) return nil } type DaeadTestSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema DaeadTestSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []DaeadTestGroup `json:"testGroups"` } type DaeadTestSchemaV1JsonSchema string const DaeadTestSchemaV1JsonSchemaDaeadTestSchemaV1Json DaeadTestSchemaV1JsonSchema = "daead_test_schema_v1.json" var enumValues_DaeadTestSchemaV1JsonSchema = []interface{}{ "daead_test_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *DaeadTestSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_DaeadTestSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DaeadTestSchemaV1JsonSchema, v) } *j = DaeadTestSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *DaeadTestSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in DaeadTestSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in DaeadTestSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in DaeadTestSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in DaeadTestSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in DaeadTestSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in DaeadTestSchemaV1Json: required") } type Plain DaeadTestSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = DaeadTestSchemaV1Json(plain) return nil } type DaeadTestVector struct { // additional authenticated data Aad string `json:"aad"` // A brief description of the test case Comment string `json:"comment"` // the ciphertext including tag Ct string `json:"ct"` // A list of flags Flags []string `json:"flags,omitempty"` // the key Key string `json:"key"` // the plaintext Msg string `json:"msg"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *DaeadTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["aad"]; raw != nil && !ok { return fmt.Errorf("field aad in DaeadTestVector: required") } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in DaeadTestVector: required") } if _, ok := raw["ct"]; raw != nil && !ok { return fmt.Errorf("field ct in DaeadTestVector: required") } if _, ok := raw["key"]; raw != nil && !ok { return fmt.Errorf("field key in DaeadTestVector: required") } if _, ok := raw["msg"]; raw != nil && !ok { return fmt.Errorf("field msg in DaeadTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in DaeadTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in DaeadTestVector: required") } type Plain DaeadTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = DaeadTestVector(plain) return nil } type DsaP1363TestGroup struct { // unencoded EC public key PublicKey DsaPublicKey `json:"publicKey"` // DER encoded public key PublicKeyDer string `json:"publicKeyDer"` // Pem encoded public key PublicKeyPem string `json:"publicKeyPem"` // the hash function used for DSA Sha string `json:"sha"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []SignatureTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type DsaP1363TestGroupType `json:"type"` } type DsaP1363TestGroupType string const DsaP1363TestGroupTypeDsaP1363Verify DsaP1363TestGroupType = "DsaP1363Verify" var enumValues_DsaP1363TestGroupType = []interface{}{ "DsaP1363Verify", } // UnmarshalJSON implements json.Unmarshaler. func (j *DsaP1363TestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_DsaP1363TestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DsaP1363TestGroupType, v) } *j = DsaP1363TestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *DsaP1363TestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["publicKey"]; raw != nil && !ok { return fmt.Errorf("field publicKey in DsaP1363TestGroup: required") } if _, ok := raw["publicKeyDer"]; raw != nil && !ok { return fmt.Errorf("field publicKeyDer in DsaP1363TestGroup: required") } if _, ok := raw["publicKeyPem"]; raw != nil && !ok { return fmt.Errorf("field publicKeyPem in DsaP1363TestGroup: required") } if _, ok := raw["sha"]; raw != nil && !ok { return fmt.Errorf("field sha in DsaP1363TestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in DsaP1363TestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in DsaP1363TestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in DsaP1363TestGroup: required") } type Plain DsaP1363TestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = DsaP1363TestGroup(plain) return nil } type DsaP1363VerifySchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema DsaP1363VerifySchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []DsaP1363TestGroup `json:"testGroups"` } type DsaP1363VerifySchemaV1JsonSchema string const DsaP1363VerifySchemaV1JsonSchemaDsaP1363VerifySchemaV1Json DsaP1363VerifySchemaV1JsonSchema = "dsa_p1363_verify_schema_v1.json" var enumValues_DsaP1363VerifySchemaV1JsonSchema = []interface{}{ "dsa_p1363_verify_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *DsaP1363VerifySchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_DsaP1363VerifySchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DsaP1363VerifySchemaV1JsonSchema, v) } *j = DsaP1363VerifySchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *DsaP1363VerifySchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in DsaP1363VerifySchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in DsaP1363VerifySchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in DsaP1363VerifySchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in DsaP1363VerifySchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in DsaP1363VerifySchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in DsaP1363VerifySchemaV1Json: required") } type Plain DsaP1363VerifySchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = DsaP1363VerifySchemaV1Json(plain) return nil } type DsaPublicKey struct { // the generator of the multiplicative subgroup G string `json:"g"` // the key size in bits KeySize int `json:"keySize"` // the modulus p P string `json:"p"` // the order of the generator g Q string `json:"q"` // the key type Type DsaPublicKeyType `json:"type"` // the public key value Y string `json:"y"` } type DsaPublicKeyType string const DsaPublicKeyTypeDsaPublicKey DsaPublicKeyType = "DsaPublicKey" var enumValues_DsaPublicKeyType = []interface{}{ "DsaPublicKey", } // UnmarshalJSON implements json.Unmarshaler. func (j *DsaPublicKeyType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_DsaPublicKeyType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DsaPublicKeyType, v) } *j = DsaPublicKeyType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *DsaPublicKey) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["g"]; raw != nil && !ok { return fmt.Errorf("field g in DsaPublicKey: required") } if _, ok := raw["keySize"]; raw != nil && !ok { return fmt.Errorf("field keySize in DsaPublicKey: required") } if _, ok := raw["p"]; raw != nil && !ok { return fmt.Errorf("field p in DsaPublicKey: required") } if _, ok := raw["q"]; raw != nil && !ok { return fmt.Errorf("field q in DsaPublicKey: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in DsaPublicKey: required") } if _, ok := raw["y"]; raw != nil && !ok { return fmt.Errorf("field y in DsaPublicKey: required") } type Plain DsaPublicKey var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = DsaPublicKey(plain) return nil } type DsaTestGroup struct { // unenocded DSA public key PublicKey DsaPublicKey `json:"publicKey"` // DER encoded public key PublicKeyDer string `json:"publicKeyDer"` // Pem encoded public key PublicKeyPem string `json:"publicKeyPem"` // the hash function used for DSA Sha string `json:"sha"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []AsnSignatureTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type DsaTestGroupType `json:"type"` } type DsaTestGroupType string const DsaTestGroupTypeDsaVerify DsaTestGroupType = "DsaVerify" var enumValues_DsaTestGroupType = []interface{}{ "DsaVerify", } // UnmarshalJSON implements json.Unmarshaler. func (j *DsaTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_DsaTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DsaTestGroupType, v) } *j = DsaTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *DsaTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["publicKey"]; raw != nil && !ok { return fmt.Errorf("field publicKey in DsaTestGroup: required") } if _, ok := raw["publicKeyDer"]; raw != nil && !ok { return fmt.Errorf("field publicKeyDer in DsaTestGroup: required") } if _, ok := raw["publicKeyPem"]; raw != nil && !ok { return fmt.Errorf("field publicKeyPem in DsaTestGroup: required") } if _, ok := raw["sha"]; raw != nil && !ok { return fmt.Errorf("field sha in DsaTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in DsaTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in DsaTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in DsaTestGroup: required") } type Plain DsaTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = DsaTestGroup(plain) return nil } type DsaVerifySchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema DsaVerifySchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []DsaTestGroup `json:"testGroups"` } type DsaVerifySchemaV1JsonSchema string const DsaVerifySchemaV1JsonSchemaDsaVerifySchemaV1Json DsaVerifySchemaV1JsonSchema = "dsa_verify_schema_v1.json" var enumValues_DsaVerifySchemaV1JsonSchema = []interface{}{ "dsa_verify_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *DsaVerifySchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_DsaVerifySchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DsaVerifySchemaV1JsonSchema, v) } *j = DsaVerifySchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *DsaVerifySchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in DsaVerifySchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in DsaVerifySchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in DsaVerifySchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in DsaVerifySchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in DsaVerifySchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in DsaVerifySchemaV1Json: required") } type Plain DsaVerifySchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = DsaVerifySchemaV1Json(plain) return nil } // A test for checking elliptic curve domain parameters. type EcCurveTest struct { // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []EcCurveTestTestsElem `json:"tests"` // Type corresponds to the JSON schema field "type". Type EcCurveTestType `json:"type"` } type EcCurveTestSchemaJson struct { // Algorithm corresponds to the JSON schema field "algorithm". Algorithm EcCurveTestSchemaJsonAlgorithm `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema EcCurveTestSchemaJsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []EcCurveTest `json:"testGroups"` } type EcCurveTestSchemaJsonAlgorithm string const EcCurveTestSchemaJsonAlgorithmEcCurveTest EcCurveTestSchemaJsonAlgorithm = "EcCurveTest" var enumValues_EcCurveTestSchemaJsonAlgorithm = []interface{}{ "EcCurveTest", } // UnmarshalJSON implements json.Unmarshaler. func (j *EcCurveTestSchemaJsonAlgorithm) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EcCurveTestSchemaJsonAlgorithm { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcCurveTestSchemaJsonAlgorithm, v) } *j = EcCurveTestSchemaJsonAlgorithm(v) return nil } type EcCurveTestSchemaJsonSchema string const EcCurveTestSchemaJsonSchemaEcCurveTestSchemaJson EcCurveTestSchemaJsonSchema = "ec_curve_test_schema.json" var enumValues_EcCurveTestSchemaJsonSchema = []interface{}{ "ec_curve_test_schema.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *EcCurveTestSchemaJsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EcCurveTestSchemaJsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcCurveTestSchemaJsonSchema, v) } *j = EcCurveTestSchemaJsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *EcCurveTestSchemaJson) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in EcCurveTestSchemaJson: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in EcCurveTestSchemaJson: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in EcCurveTestSchemaJson: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in EcCurveTestSchemaJson: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in EcCurveTestSchemaJson: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in EcCurveTestSchemaJson: required") } type Plain EcCurveTestSchemaJson var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcCurveTestSchemaJson(plain) return nil } type EcCurveTestTestsElem struct { // Coefficient a of the curve's Weierstrass equation A string `json:"a"` // Coefficient b of the curve's Weierstrass equation B string `json:"b"` // A brief description of the test case Comment *string `json:"comment,omitempty"` // A list of flags Flags []string `json:"flags,omitempty"` // x coordinate of the curve's generator Gx string `json:"gx"` // y coordinate of the curve's generator Gy string `json:"gy"` // Cofactor of the curve H int `json:"h"` // Order of the curve N string `json:"n"` // Name identifying the elliptic curve Name *string `json:"name,omitempty"` // Object identifier of the ellptic curve Oid string `json:"oid"` // Prime identifying the field of definition P string `json:"p"` // Standard containing the domain parameters Ref *string `json:"ref,omitempty"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *EcCurveTestTestsElem) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["a"]; raw != nil && !ok { return fmt.Errorf("field a in EcCurveTestTestsElem: required") } if _, ok := raw["b"]; raw != nil && !ok { return fmt.Errorf("field b in EcCurveTestTestsElem: required") } if _, ok := raw["gx"]; raw != nil && !ok { return fmt.Errorf("field gx in EcCurveTestTestsElem: required") } if _, ok := raw["gy"]; raw != nil && !ok { return fmt.Errorf("field gy in EcCurveTestTestsElem: required") } if _, ok := raw["h"]; raw != nil && !ok { return fmt.Errorf("field h in EcCurveTestTestsElem: required") } if _, ok := raw["n"]; raw != nil && !ok { return fmt.Errorf("field n in EcCurveTestTestsElem: required") } if _, ok := raw["oid"]; raw != nil && !ok { return fmt.Errorf("field oid in EcCurveTestTestsElem: required") } if _, ok := raw["p"]; raw != nil && !ok { return fmt.Errorf("field p in EcCurveTestTestsElem: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in EcCurveTestTestsElem: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in EcCurveTestTestsElem: required") } type Plain EcCurveTestTestsElem var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcCurveTestTestsElem(plain) return nil } type EcCurveTestType string const EcCurveTestTypeEcCurveTest EcCurveTestType = "EcCurveTest" var enumValues_EcCurveTestType = []interface{}{ "EcCurveTest", } // UnmarshalJSON implements json.Unmarshaler. func (j *EcCurveTestType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EcCurveTestType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcCurveTestType, v) } *j = EcCurveTestType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *EcCurveTest) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in EcCurveTest: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in EcCurveTest: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in EcCurveTest: required") } type Plain EcCurveTest var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcCurveTest(plain) return nil } type EcPublicKey struct { // the EC group used by this public key Curve string `json:"curve"` // the key size in bits KeySize int `json:"keySize"` // the key type Type EcPublicKeyType `json:"type"` // encoded public key point Uncompressed string `json:"uncompressed"` // the x-coordinate of the public key point Wx string `json:"wx"` // the y-coordinate of the public key point Wy string `json:"wy"` } type EcPublicKeyType string const EcPublicKeyTypeEcPublicKey EcPublicKeyType = "EcPublicKey" var enumValues_EcPublicKeyType = []interface{}{ "EcPublicKey", } // UnmarshalJSON implements json.Unmarshaler. func (j *EcPublicKeyType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EcPublicKeyType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcPublicKeyType, v) } *j = EcPublicKeyType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *EcPublicKey) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["curve"]; raw != nil && !ok { return fmt.Errorf("field curve in EcPublicKey: required") } if _, ok := raw["keySize"]; raw != nil && !ok { return fmt.Errorf("field keySize in EcPublicKey: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in EcPublicKey: required") } if _, ok := raw["uncompressed"]; raw != nil && !ok { return fmt.Errorf("field uncompressed in EcPublicKey: required") } if _, ok := raw["wx"]; raw != nil && !ok { return fmt.Errorf("field wx in EcPublicKey: required") } if _, ok := raw["wy"]; raw != nil && !ok { return fmt.Errorf("field wy in EcPublicKey: required") } type Plain EcPublicKey var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcPublicKey(plain) return nil } type EcdhEcpointTestGroup struct { // the name of the curve Curve string `json:"curve"` // the encoding of the public key Encoding string `json:"encoding"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []EcdhEcpointTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type EcdhEcpointTestGroupType `json:"type"` } type EcdhEcpointTestGroupType string const EcdhEcpointTestGroupTypeEcdhEcpointTest EcdhEcpointTestGroupType = "EcdhEcpointTest" var enumValues_EcdhEcpointTestGroupType = []interface{}{ "EcdhEcpointTest", } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhEcpointTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EcdhEcpointTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcdhEcpointTestGroupType, v) } *j = EcdhEcpointTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhEcpointTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["curve"]; raw != nil && !ok { return fmt.Errorf("field curve in EcdhEcpointTestGroup: required") } if _, ok := raw["encoding"]; raw != nil && !ok { return fmt.Errorf("field encoding in EcdhEcpointTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in EcdhEcpointTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in EcdhEcpointTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in EcdhEcpointTestGroup: required") } type Plain EcdhEcpointTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcdhEcpointTestGroup(plain) return nil } type EcdhEcpointTestSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema EcdhEcpointTestSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []EcdhEcpointTestGroup `json:"testGroups"` } type EcdhEcpointTestSchemaV1JsonSchema string const EcdhEcpointTestSchemaV1JsonSchemaEcdhEcpointTestSchemaV1Json EcdhEcpointTestSchemaV1JsonSchema = "ecdh_ecpoint_test_schema_v1.json" var enumValues_EcdhEcpointTestSchemaV1JsonSchema = []interface{}{ "ecdh_ecpoint_test_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhEcpointTestSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EcdhEcpointTestSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcdhEcpointTestSchemaV1JsonSchema, v) } *j = EcdhEcpointTestSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhEcpointTestSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in EcdhEcpointTestSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in EcdhEcpointTestSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in EcdhEcpointTestSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in EcdhEcpointTestSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in EcdhEcpointTestSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in EcdhEcpointTestSchemaV1Json: required") } type Plain EcdhEcpointTestSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcdhEcpointTestSchemaV1Json(plain) return nil } type EcdhEcpointTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // The private exponent Private string `json:"private"` // ASN encoded public point Public string `json:"public"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // The shared secret key Shared string `json:"shared"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhEcpointTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in EcdhEcpointTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in EcdhEcpointTestVector: required") } if _, ok := raw["private"]; raw != nil && !ok { return fmt.Errorf("field private in EcdhEcpointTestVector: required") } if _, ok := raw["public"]; raw != nil && !ok { return fmt.Errorf("field public in EcdhEcpointTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in EcdhEcpointTestVector: required") } if _, ok := raw["shared"]; raw != nil && !ok { return fmt.Errorf("field shared in EcdhEcpointTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in EcdhEcpointTestVector: required") } type Plain EcdhEcpointTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcdhEcpointTestVector(plain) return nil } type EcdhPemTestGroup struct { // the name of the curve Curve string `json:"curve"` // the encoding of the public key Encoding string `json:"encoding"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []EcdhPemTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type EcdhPemTestGroupType `json:"type"` } type EcdhPemTestGroupType string const EcdhPemTestGroupTypeEcdhPemTest EcdhPemTestGroupType = "EcdhPemTest" var enumValues_EcdhPemTestGroupType = []interface{}{ "EcdhPemTest", } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhPemTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EcdhPemTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcdhPemTestGroupType, v) } *j = EcdhPemTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhPemTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["curve"]; raw != nil && !ok { return fmt.Errorf("field curve in EcdhPemTestGroup: required") } if _, ok := raw["encoding"]; raw != nil && !ok { return fmt.Errorf("field encoding in EcdhPemTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in EcdhPemTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in EcdhPemTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in EcdhPemTestGroup: required") } type Plain EcdhPemTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcdhPemTestGroup(plain) return nil } type EcdhPemTestSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema EcdhPemTestSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []EcdhPemTestGroup `json:"testGroups"` } type EcdhPemTestSchemaV1JsonSchema string const EcdhPemTestSchemaV1JsonSchemaEcdhPemTestSchemaV1Json EcdhPemTestSchemaV1JsonSchema = "ecdh_pem_test_schema_v1.json" var enumValues_EcdhPemTestSchemaV1JsonSchema = []interface{}{ "ecdh_pem_test_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhPemTestSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EcdhPemTestSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcdhPemTestSchemaV1JsonSchema, v) } *j = EcdhPemTestSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhPemTestSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in EcdhPemTestSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in EcdhPemTestSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in EcdhPemTestSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in EcdhPemTestSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in EcdhPemTestSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in EcdhPemTestSchemaV1Json: required") } type Plain EcdhPemTestSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcdhPemTestSchemaV1Json(plain) return nil } type EcdhPemTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // Pem encoded private key Private string `json:"private"` // Pem encoded public key Public string `json:"public"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // The shared secret key Shared string `json:"shared"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhPemTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in EcdhPemTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in EcdhPemTestVector: required") } if _, ok := raw["private"]; raw != nil && !ok { return fmt.Errorf("field private in EcdhPemTestVector: required") } if _, ok := raw["public"]; raw != nil && !ok { return fmt.Errorf("field public in EcdhPemTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in EcdhPemTestVector: required") } if _, ok := raw["shared"]; raw != nil && !ok { return fmt.Errorf("field shared in EcdhPemTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in EcdhPemTestVector: required") } type Plain EcdhPemTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcdhPemTestVector(plain) return nil } type EcdhTestGroup struct { // the name of the curve Curve string `json:"curve"` // the encoding of the public key Encoding string `json:"encoding"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []EcdhTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type EcdhTestGroupType `json:"type"` } type EcdhTestGroupType string const EcdhTestGroupTypeEcdhTest EcdhTestGroupType = "EcdhTest" var enumValues_EcdhTestGroupType = []interface{}{ "EcdhTest", } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EcdhTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcdhTestGroupType, v) } *j = EcdhTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["curve"]; raw != nil && !ok { return fmt.Errorf("field curve in EcdhTestGroup: required") } if _, ok := raw["encoding"]; raw != nil && !ok { return fmt.Errorf("field encoding in EcdhTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in EcdhTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in EcdhTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in EcdhTestGroup: required") } type Plain EcdhTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcdhTestGroup(plain) return nil } type EcdhTestSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema EcdhTestSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []EcdhTestGroup `json:"testGroups"` } type EcdhTestSchemaV1JsonSchema string const EcdhTestSchemaV1JsonSchemaEcdhTestSchemaV1Json EcdhTestSchemaV1JsonSchema = "ecdh_test_schema_v1.json" var enumValues_EcdhTestSchemaV1JsonSchema = []interface{}{ "ecdh_test_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhTestSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EcdhTestSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcdhTestSchemaV1JsonSchema, v) } *j = EcdhTestSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhTestSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in EcdhTestSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in EcdhTestSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in EcdhTestSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in EcdhTestSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in EcdhTestSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in EcdhTestSchemaV1Json: required") } type Plain EcdhTestSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcdhTestSchemaV1Json(plain) return nil } type EcdhTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // the private key Private string `json:"private"` // Encoded public key Public string `json:"public"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // The shared secret key Shared string `json:"shared"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in EcdhTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in EcdhTestVector: required") } if _, ok := raw["private"]; raw != nil && !ok { return fmt.Errorf("field private in EcdhTestVector: required") } if _, ok := raw["public"]; raw != nil && !ok { return fmt.Errorf("field public in EcdhTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in EcdhTestVector: required") } if _, ok := raw["shared"]; raw != nil && !ok { return fmt.Errorf("field shared in EcdhTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in EcdhTestVector: required") } type Plain EcdhTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcdhTestVector(plain) return nil } type EcdhWebcryptoTestGroup struct { // the name of the curve Curve string `json:"curve"` // the encoding of the public key Encoding string `json:"encoding"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []EcdhWebcryptoTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type EcdhWebcryptoTestGroupType `json:"type"` } type EcdhWebcryptoTestGroupType string const EcdhWebcryptoTestGroupTypeEcdhWebcryptoTest EcdhWebcryptoTestGroupType = "EcdhWebcryptoTest" var enumValues_EcdhWebcryptoTestGroupType = []interface{}{ "EcdhWebcryptoTest", } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhWebcryptoTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EcdhWebcryptoTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcdhWebcryptoTestGroupType, v) } *j = EcdhWebcryptoTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhWebcryptoTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["curve"]; raw != nil && !ok { return fmt.Errorf("field curve in EcdhWebcryptoTestGroup: required") } if _, ok := raw["encoding"]; raw != nil && !ok { return fmt.Errorf("field encoding in EcdhWebcryptoTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in EcdhWebcryptoTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in EcdhWebcryptoTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in EcdhWebcryptoTestGroup: required") } type Plain EcdhWebcryptoTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcdhWebcryptoTestGroup(plain) return nil } type EcdhWebcryptoTestSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema EcdhWebcryptoTestSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []EcdhWebcryptoTestGroup `json:"testGroups"` } type EcdhWebcryptoTestSchemaV1JsonSchema string const EcdhWebcryptoTestSchemaV1JsonSchemaEcdhWebcryptoTestSchemaV1Json EcdhWebcryptoTestSchemaV1JsonSchema = "ecdh_webcrypto_test_schema_v1.json" var enumValues_EcdhWebcryptoTestSchemaV1JsonSchema = []interface{}{ "ecdh_webcrypto_test_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhWebcryptoTestSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EcdhWebcryptoTestSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcdhWebcryptoTestSchemaV1JsonSchema, v) } *j = EcdhWebcryptoTestSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhWebcryptoTestSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in EcdhWebcryptoTestSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in EcdhWebcryptoTestSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in EcdhWebcryptoTestSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in EcdhWebcryptoTestSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in EcdhWebcryptoTestSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in EcdhWebcryptoTestSchemaV1Json: required") } type Plain EcdhWebcryptoTestSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcdhWebcryptoTestSchemaV1Json(plain) return nil } type EcdhWebcryptoTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // Private key in webcrypto format Private EcdhWebcryptoTestVectorPrivate `json:"private"` // Public key in webcrypto format Public EcdhWebcryptoTestVectorPublic `json:"public"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // The shared secret key Shared string `json:"shared"` // Identifier of the test case TcId int `json:"tcId"` } // Private key in webcrypto format type EcdhWebcryptoTestVectorPrivate map[string]interface{} // Public key in webcrypto format type EcdhWebcryptoTestVectorPublic map[string]interface{} // UnmarshalJSON implements json.Unmarshaler. func (j *EcdhWebcryptoTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in EcdhWebcryptoTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in EcdhWebcryptoTestVector: required") } if _, ok := raw["private"]; raw != nil && !ok { return fmt.Errorf("field private in EcdhWebcryptoTestVector: required") } if _, ok := raw["public"]; raw != nil && !ok { return fmt.Errorf("field public in EcdhWebcryptoTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in EcdhWebcryptoTestVector: required") } if _, ok := raw["shared"]; raw != nil && !ok { return fmt.Errorf("field shared in EcdhWebcryptoTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in EcdhWebcryptoTestVector: required") } type Plain EcdhWebcryptoTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcdhWebcryptoTestVector(plain) return nil } type EcdsaP1363TestGroup struct { // unencoded EC public key PublicKey EcPublicKey `json:"publicKey"` // DER encoded public key PublicKeyDer string `json:"publicKeyDer"` // PublicKeyJwk corresponds to the JSON schema field "publicKeyJwk". PublicKeyJwk *JsonWebKey `json:"publicKeyJwk,omitempty"` // Pem encoded public key PublicKeyPem string `json:"publicKeyPem"` // the hash function used for ECDSA Sha string `json:"sha"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []SignatureTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type EcdsaP1363TestGroupType `json:"type"` } type EcdsaP1363TestGroupType string const EcdsaP1363TestGroupTypeEcdsaP1363Verify EcdsaP1363TestGroupType = "EcdsaP1363Verify" var enumValues_EcdsaP1363TestGroupType = []interface{}{ "EcdsaP1363Verify", } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdsaP1363TestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EcdsaP1363TestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcdsaP1363TestGroupType, v) } *j = EcdsaP1363TestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdsaP1363TestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["publicKey"]; raw != nil && !ok { return fmt.Errorf("field publicKey in EcdsaP1363TestGroup: required") } if _, ok := raw["publicKeyDer"]; raw != nil && !ok { return fmt.Errorf("field publicKeyDer in EcdsaP1363TestGroup: required") } if _, ok := raw["publicKeyPem"]; raw != nil && !ok { return fmt.Errorf("field publicKeyPem in EcdsaP1363TestGroup: required") } if _, ok := raw["sha"]; raw != nil && !ok { return fmt.Errorf("field sha in EcdsaP1363TestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in EcdsaP1363TestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in EcdsaP1363TestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in EcdsaP1363TestGroup: required") } type Plain EcdsaP1363TestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcdsaP1363TestGroup(plain) return nil } type EcdsaP1363VerifySchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema EcdsaP1363VerifySchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []EcdsaP1363TestGroup `json:"testGroups"` } type EcdsaP1363VerifySchemaV1JsonSchema string const EcdsaP1363VerifySchemaV1JsonSchemaEcdsaP1363VerifySchemaV1Json EcdsaP1363VerifySchemaV1JsonSchema = "ecdsa_p1363_verify_schema_v1.json" var enumValues_EcdsaP1363VerifySchemaV1JsonSchema = []interface{}{ "ecdsa_p1363_verify_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdsaP1363VerifySchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EcdsaP1363VerifySchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcdsaP1363VerifySchemaV1JsonSchema, v) } *j = EcdsaP1363VerifySchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdsaP1363VerifySchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in EcdsaP1363VerifySchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in EcdsaP1363VerifySchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in EcdsaP1363VerifySchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in EcdsaP1363VerifySchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in EcdsaP1363VerifySchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in EcdsaP1363VerifySchemaV1Json: required") } type Plain EcdsaP1363VerifySchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcdsaP1363VerifySchemaV1Json(plain) return nil } type EcdsaTestGroup struct { // unencoded EC public key PublicKey EcPublicKey `json:"publicKey"` // DER encoded public key PublicKeyDer string `json:"publicKeyDer"` // Pem encoded public key PublicKeyPem string `json:"publicKeyPem"` // the hash function used for ECDSA Sha string `json:"sha"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []AsnSignatureTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type EcdsaTestGroupType `json:"type"` } type EcdsaTestGroupType string const EcdsaTestGroupTypeEcdsaVerify EcdsaTestGroupType = "EcdsaVerify" var enumValues_EcdsaTestGroupType = []interface{}{ "EcdsaVerify", } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdsaTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EcdsaTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcdsaTestGroupType, v) } *j = EcdsaTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdsaTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["publicKey"]; raw != nil && !ok { return fmt.Errorf("field publicKey in EcdsaTestGroup: required") } if _, ok := raw["publicKeyDer"]; raw != nil && !ok { return fmt.Errorf("field publicKeyDer in EcdsaTestGroup: required") } if _, ok := raw["publicKeyPem"]; raw != nil && !ok { return fmt.Errorf("field publicKeyPem in EcdsaTestGroup: required") } if _, ok := raw["sha"]; raw != nil && !ok { return fmt.Errorf("field sha in EcdsaTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in EcdsaTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in EcdsaTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in EcdsaTestGroup: required") } type Plain EcdsaTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcdsaTestGroup(plain) return nil } type EcdsaVerifySchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema EcdsaVerifySchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []EcdsaTestGroup `json:"testGroups"` } type EcdsaVerifySchemaV1JsonSchema string const EcdsaVerifySchemaV1JsonSchemaEcdsaVerifySchemaV1Json EcdsaVerifySchemaV1JsonSchema = "ecdsa_verify_schema_v1.json" var enumValues_EcdsaVerifySchemaV1JsonSchema = []interface{}{ "ecdsa_verify_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdsaVerifySchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EcdsaVerifySchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EcdsaVerifySchemaV1JsonSchema, v) } *j = EcdsaVerifySchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *EcdsaVerifySchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in EcdsaVerifySchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in EcdsaVerifySchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in EcdsaVerifySchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in EcdsaVerifySchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in EcdsaVerifySchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in EcdsaVerifySchemaV1Json: required") } type Plain EcdsaVerifySchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EcdsaVerifySchemaV1Json(plain) return nil } type EddsaTestGroup struct { // PublicKey corresponds to the JSON schema field "publicKey". PublicKey PublicKey `json:"publicKey"` // Asn encoded public key PublicKeyDer string `json:"publicKeyDer"` // the public key in webcrypto format PublicKeyJwk *JsonWebKey `json:"publicKeyJwk,omitempty"` // PEM encoded public key PublicKeyPem string `json:"publicKeyPem"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []SignatureTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type EddsaTestGroupType `json:"type"` } type EddsaTestGroupType string const EddsaTestGroupTypeEddsaVerify EddsaTestGroupType = "EddsaVerify" var enumValues_EddsaTestGroupType = []interface{}{ "EddsaVerify", } // UnmarshalJSON implements json.Unmarshaler. func (j *EddsaTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EddsaTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EddsaTestGroupType, v) } *j = EddsaTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *EddsaTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["publicKey"]; raw != nil && !ok { return fmt.Errorf("field publicKey in EddsaTestGroup: required") } if _, ok := raw["publicKeyDer"]; raw != nil && !ok { return fmt.Errorf("field publicKeyDer in EddsaTestGroup: required") } if _, ok := raw["publicKeyPem"]; raw != nil && !ok { return fmt.Errorf("field publicKeyPem in EddsaTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in EddsaTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in EddsaTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in EddsaTestGroup: required") } type Plain EddsaTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EddsaTestGroup(plain) return nil } type EddsaVerifySchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema EddsaVerifySchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []EddsaTestGroup `json:"testGroups"` } type EddsaVerifySchemaV1JsonSchema string const EddsaVerifySchemaV1JsonSchemaEddsaVerifySchemaV1Json EddsaVerifySchemaV1JsonSchema = "eddsa_verify_schema_v1.json" var enumValues_EddsaVerifySchemaV1JsonSchema = []interface{}{ "eddsa_verify_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *EddsaVerifySchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_EddsaVerifySchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_EddsaVerifySchemaV1JsonSchema, v) } *j = EddsaVerifySchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *EddsaVerifySchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in EddsaVerifySchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in EddsaVerifySchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in EddsaVerifySchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in EddsaVerifySchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in EddsaVerifySchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in EddsaVerifySchemaV1Json: required") } type Plain EddsaVerifySchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = EddsaVerifySchemaV1Json(plain) return nil } type HkdfTestGroup struct { // the size of the ikm in bits KeySize int `json:"keySize"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []HkdfTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type HkdfTestGroupType `json:"type"` } type HkdfTestGroupType string const HkdfTestGroupTypeHkdfTest HkdfTestGroupType = "HkdfTest" var enumValues_HkdfTestGroupType = []interface{}{ "HkdfTest", } // UnmarshalJSON implements json.Unmarshaler. func (j *HkdfTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_HkdfTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_HkdfTestGroupType, v) } *j = HkdfTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *HkdfTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["keySize"]; raw != nil && !ok { return fmt.Errorf("field keySize in HkdfTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in HkdfTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in HkdfTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in HkdfTestGroup: required") } type Plain HkdfTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = HkdfTestGroup(plain) return nil } type HkdfTestSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema HkdfTestSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []HkdfTestGroup `json:"testGroups"` } type HkdfTestSchemaV1JsonSchema string const HkdfTestSchemaV1JsonSchemaHkdfTestSchemaV1Json HkdfTestSchemaV1JsonSchema = "hkdf_test_schema_v1.json" var enumValues_HkdfTestSchemaV1JsonSchema = []interface{}{ "hkdf_test_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *HkdfTestSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_HkdfTestSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_HkdfTestSchemaV1JsonSchema, v) } *j = HkdfTestSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *HkdfTestSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in HkdfTestSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in HkdfTestSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in HkdfTestSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in HkdfTestSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in HkdfTestSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in HkdfTestSchemaV1Json: required") } type Plain HkdfTestSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = HkdfTestSchemaV1Json(plain) return nil } type HkdfTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // the key (input key material) Ikm string `json:"ikm"` // additional information used in the key derivation Info string `json:"info"` // the generated bytes (output key material) Okm string `json:"okm"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // the salt for the key derivation Salt string `json:"salt"` // the size of the output in bytes Size int `json:"size"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *HkdfTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in HkdfTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in HkdfTestVector: required") } if _, ok := raw["ikm"]; raw != nil && !ok { return fmt.Errorf("field ikm in HkdfTestVector: required") } if _, ok := raw["info"]; raw != nil && !ok { return fmt.Errorf("field info in HkdfTestVector: required") } if _, ok := raw["okm"]; raw != nil && !ok { return fmt.Errorf("field okm in HkdfTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in HkdfTestVector: required") } if _, ok := raw["salt"]; raw != nil && !ok { return fmt.Errorf("field salt in HkdfTestVector: required") } if _, ok := raw["size"]; raw != nil && !ok { return fmt.Errorf("field size in HkdfTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in HkdfTestVector: required") } type Plain HkdfTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = HkdfTestVector(plain) return nil } type IndCpaTestGroup struct { // the IV size in bits IvSize int `json:"ivSize"` // the keySize in bits KeySize int `json:"keySize"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []IndCpaTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type IndCpaTestGroupType `json:"type"` } type IndCpaTestGroupType string const IndCpaTestGroupTypeIndCpaTest IndCpaTestGroupType = "IndCpaTest" var enumValues_IndCpaTestGroupType = []interface{}{ "IndCpaTest", } // UnmarshalJSON implements json.Unmarshaler. func (j *IndCpaTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_IndCpaTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_IndCpaTestGroupType, v) } *j = IndCpaTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *IndCpaTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["ivSize"]; raw != nil && !ok { return fmt.Errorf("field ivSize in IndCpaTestGroup: required") } if _, ok := raw["keySize"]; raw != nil && !ok { return fmt.Errorf("field keySize in IndCpaTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in IndCpaTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in IndCpaTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in IndCpaTestGroup: required") } type Plain IndCpaTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = IndCpaTestGroup(plain) return nil } type IndCpaTestSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema IndCpaTestSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []IndCpaTestGroup `json:"testGroups"` } type IndCpaTestSchemaV1JsonSchema string const IndCpaTestSchemaV1JsonSchemaIndCpaTestSchemaV1Json IndCpaTestSchemaV1JsonSchema = "ind_cpa_test_schema_v1.json" var enumValues_IndCpaTestSchemaV1JsonSchema = []interface{}{ "ind_cpa_test_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *IndCpaTestSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_IndCpaTestSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_IndCpaTestSchemaV1JsonSchema, v) } *j = IndCpaTestSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *IndCpaTestSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in IndCpaTestSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in IndCpaTestSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in IndCpaTestSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in IndCpaTestSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in IndCpaTestSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in IndCpaTestSchemaV1Json: required") } type Plain IndCpaTestSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = IndCpaTestSchemaV1Json(plain) return nil } type IndCpaTestVector struct { // A brief description of the test case Comment string `json:"comment"` // the raw ciphertext (without IV) Ct string `json:"ct"` // A list of flags Flags []string `json:"flags"` // the initialization vector Iv string `json:"iv"` // the key Key string `json:"key"` // the plaintext Msg string `json:"msg"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *IndCpaTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in IndCpaTestVector: required") } if _, ok := raw["ct"]; raw != nil && !ok { return fmt.Errorf("field ct in IndCpaTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in IndCpaTestVector: required") } if _, ok := raw["iv"]; raw != nil && !ok { return fmt.Errorf("field iv in IndCpaTestVector: required") } if _, ok := raw["key"]; raw != nil && !ok { return fmt.Errorf("field key in IndCpaTestVector: required") } if _, ok := raw["msg"]; raw != nil && !ok { return fmt.Errorf("field msg in IndCpaTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in IndCpaTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in IndCpaTestVector: required") } type Plain IndCpaTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = IndCpaTestVector(plain) return nil } type JsonWebCryptoSchemaV1Json struct { // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema JsonWebCryptoSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []JsonWebCryptoTestGroup `json:"testGroups"` } type JsonWebCryptoSchemaV1JsonSchema string const JsonWebCryptoSchemaV1JsonSchemaJsonWebCryptoSchemaV1Json JsonWebCryptoSchemaV1JsonSchema = "json_web_crypto_schema_v1.json" var enumValues_JsonWebCryptoSchemaV1JsonSchema = []interface{}{ "json_web_crypto_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebCryptoSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_JsonWebCryptoSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_JsonWebCryptoSchemaV1JsonSchema, v) } *j = JsonWebCryptoSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebCryptoSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in JsonWebCryptoSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in JsonWebCryptoSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in JsonWebCryptoSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in JsonWebCryptoSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in JsonWebCryptoSchemaV1Json: required") } type Plain JsonWebCryptoSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = JsonWebCryptoSchemaV1Json(plain) return nil } type JsonWebCryptoTestGroup struct { // a description of what these tests have in common Comment *string `json:"comment,omitempty"` // the private or secret key in webcrypto format Private JsonWebKeyOrKeyset `json:"private,omitempty"` // [optional] the public key in webcrypto format Public JsonWebKeyOrKeyset `json:"public,omitempty"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []JsonWebCryptoTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type *JsonWebCryptoTestGroupType `json:"type,omitempty"` } type JsonWebCryptoTestGroupType string const JsonWebCryptoTestGroupTypeJsonWebCrypto JsonWebCryptoTestGroupType = "JsonWebCrypto" var enumValues_JsonWebCryptoTestGroupType = []interface{}{ "JsonWebCrypto", } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebCryptoTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_JsonWebCryptoTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_JsonWebCryptoTestGroupType, v) } *j = JsonWebCryptoTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebCryptoTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in JsonWebCryptoTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in JsonWebCryptoTestGroup: required") } type Plain JsonWebCryptoTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = JsonWebCryptoTestGroup(plain) return nil } type JsonWebCryptoTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // The JSON Web Encryption Jwe interface{} `json:"jwe,omitempty"` // The JSON Web Signature Jws interface{} `json:"jws,omitempty"` // [optional] Plaintext Pt *string `json:"pt,omitempty"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebCryptoTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in JsonWebCryptoTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in JsonWebCryptoTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in JsonWebCryptoTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in JsonWebCryptoTestVector: required") } type Plain JsonWebCryptoTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = JsonWebCryptoTestVector(plain) return nil } type JsonWebEncryptionSchemaV1Json struct { // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema JsonWebEncryptionSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []JsonWebEncryptionTestGroup `json:"testGroups"` } type JsonWebEncryptionSchemaV1JsonSchema string const JsonWebEncryptionSchemaV1JsonSchemaJsonWebEncryptionSchemaV1Json JsonWebEncryptionSchemaV1JsonSchema = "json_web_encryption_schema_v1.json" var enumValues_JsonWebEncryptionSchemaV1JsonSchema = []interface{}{ "json_web_encryption_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebEncryptionSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_JsonWebEncryptionSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_JsonWebEncryptionSchemaV1JsonSchema, v) } *j = JsonWebEncryptionSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebEncryptionSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in JsonWebEncryptionSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in JsonWebEncryptionSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in JsonWebEncryptionSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in JsonWebEncryptionSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in JsonWebEncryptionSchemaV1Json: required") } type Plain JsonWebEncryptionSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = JsonWebEncryptionSchemaV1Json(plain) return nil } type JsonWebEncryptionTestGroup struct { // a description of what these tests have in common Comment *string `json:"comment,omitempty"` // the private key Private *JsonWebKey `json:"private,omitempty"` // the [optional] public key Public *JsonWebKey `json:"public,omitempty"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []JsonWebEncryptionTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type *JsonWebEncryptionTestGroupType `json:"type,omitempty"` } type JsonWebEncryptionTestGroupType string const JsonWebEncryptionTestGroupTypeJsonWebEncryption JsonWebEncryptionTestGroupType = "JsonWebEncryption" var enumValues_JsonWebEncryptionTestGroupType = []interface{}{ "JsonWebEncryption", } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebEncryptionTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_JsonWebEncryptionTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_JsonWebEncryptionTestGroupType, v) } *j = JsonWebEncryptionTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebEncryptionTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in JsonWebEncryptionTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in JsonWebEncryptionTestGroup: required") } type Plain JsonWebEncryptionTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = JsonWebEncryptionTestGroup(plain) return nil } type JsonWebEncryptionTestVector struct { // A brief description of the test case Comment string `json:"comment"` // the content encryption algorithm Enc string `json:"enc"` // A list of flags Flags []string `json:"flags"` // The JSON Web Encryption in compact form Jwe string `json:"jwe"` // [optional] Plaintext Pt *string `json:"pt,omitempty"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebEncryptionTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in JsonWebEncryptionTestVector: required") } if _, ok := raw["enc"]; raw != nil && !ok { return fmt.Errorf("field enc in JsonWebEncryptionTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in JsonWebEncryptionTestVector: required") } if _, ok := raw["jwe"]; raw != nil && !ok { return fmt.Errorf("field jwe in JsonWebEncryptionTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in JsonWebEncryptionTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in JsonWebEncryptionTestVector: required") } type Plain JsonWebEncryptionTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = JsonWebEncryptionTestVector(plain) return nil } // see https://tools.ietf.org/html/rfc7517#section-4 and // https://tools.ietf.org/html/rfc7518#section-6 type JsonWebKey struct { // the encryption/signing algorithm to use Alg *string `json:"alg,omitempty"` // which defined curve to use Crv *JsonWebKeyCrv `json:"crv,omitempty"` // the private key value of an EC key or private exponent for RSA D *string `json:"d,omitempty"` // the first factor Chinese Remainder Theorem exponent of an RSA key Dp *string `json:"dp,omitempty"` // the second factor Chinese Remainder Theorem exponent of an RSA key Dq *string `json:"dq,omitempty"` // the public exponent of an RSA key E *string `json:"e,omitempty"` // the secret key value of an oct key K *string `json:"k,omitempty"` // an alternative to use KeyOps []string `json:"key_ops,omitempty"` // the ID of the key entry Kid *string `json:"kid,omitempty"` // the family of algorithms the key belongs to Kty *JsonWebKeyKty `json:"kty,omitempty"` // the public modulus of an RSA key N *string `json:"n,omitempty"` // the first prime factgor of an RSA key P *string `json:"p,omitempty"` // the second prime factor of an RSA key Q *string `json:"q,omitempty"` // the first factor Chinese Remainder Theorem coefficient of an RSA key Qi *string `json:"qi,omitempty"` // what type of crypto operation to perform Use *JsonWebKeyUse `json:"use,omitempty"` // the x-coordinate of an EC key point X *string `json:"x,omitempty"` // the y-coordinate of an EC key point Y *string `json:"y,omitempty"` } type JsonWebKeyCrv string const JsonWebKeyCrvEd25519 JsonWebKeyCrv = "Ed25519" const JsonWebKeyCrvEd448 JsonWebKeyCrv = "Ed448" const JsonWebKeyCrvP256 JsonWebKeyCrv = "P-256" const JsonWebKeyCrvP256K JsonWebKeyCrv = "P-256K" const JsonWebKeyCrvP384 JsonWebKeyCrv = "P-384" const JsonWebKeyCrvP521 JsonWebKeyCrv = "P-521" const JsonWebKeyCrvSecp256K1 JsonWebKeyCrv = "secp256k1" const JsonWebKeyCrvX25519 JsonWebKeyCrv = "X25519" const JsonWebKeyCrvX448 JsonWebKeyCrv = "X448" var enumValues_JsonWebKeyCrv = []interface{}{ "P-256", "P-256K", "P-384", "P-521", "secp256k1", "X448", "X25519", "Ed25519", "Ed448", } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebKeyCrv) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_JsonWebKeyCrv { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_JsonWebKeyCrv, v) } *j = JsonWebKeyCrv(v) return nil } type JsonWebKeyKty string const JsonWebKeyKtyBlank JsonWebKeyKty = "" const JsonWebKeyKtyEC JsonWebKeyKty = "EC" const JsonWebKeyKtyOKP JsonWebKeyKty = "OKP" const JsonWebKeyKtyOct JsonWebKeyKty = "oct" const JsonWebKeyKtyRSA JsonWebKeyKty = "RSA" var enumValues_JsonWebKeyKty = []interface{}{ "", "oct", "EC", "RSA", "OKP", } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebKeyKty) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_JsonWebKeyKty { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_JsonWebKeyKty, v) } *j = JsonWebKeyKty(v) return nil } type JsonWebKeyOrKeyset interface{} type JsonWebKeySchemaV1Json struct { // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema JsonWebKeySchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []JsonWebKeyTestGroup `json:"testGroups"` } type JsonWebKeySchemaV1JsonSchema string const JsonWebKeySchemaV1JsonSchemaJsonWebKeySchemaV1Json JsonWebKeySchemaV1JsonSchema = "json_web_key_schema_v1.json" var enumValues_JsonWebKeySchemaV1JsonSchema = []interface{}{ "json_web_key_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebKeySchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_JsonWebKeySchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_JsonWebKeySchemaV1JsonSchema, v) } *j = JsonWebKeySchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebKeySchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in JsonWebKeySchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in JsonWebKeySchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in JsonWebKeySchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in JsonWebKeySchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in JsonWebKeySchemaV1Json: required") } type Plain JsonWebKeySchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = JsonWebKeySchemaV1Json(plain) return nil } type JsonWebKeyTestGroup struct { // a description of what these tests have in common Comment *string `json:"comment,omitempty"` // the private or secret keyset in webcrypto format Private *JsonWebKeyset `json:"private,omitempty"` // the public keyset in webcrypto format Public *JsonWebKeyset `json:"public,omitempty"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []JsonWebKeyTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type *JsonWebKeyTestGroupType `json:"type,omitempty"` } type JsonWebKeyTestGroupType string const JsonWebKeyTestGroupTypeJsonWebKey JsonWebKeyTestGroupType = "JsonWebKey" var enumValues_JsonWebKeyTestGroupType = []interface{}{ "JsonWebKey", } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebKeyTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_JsonWebKeyTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_JsonWebKeyTestGroupType, v) } *j = JsonWebKeyTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebKeyTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in JsonWebKeyTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in JsonWebKeyTestGroup: required") } type Plain JsonWebKeyTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = JsonWebKeyTestGroup(plain) return nil } type JsonWebKeyTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // The JSON Web Signature in compact form Jws string `json:"jws"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebKeyTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in JsonWebKeyTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in JsonWebKeyTestVector: required") } if _, ok := raw["jws"]; raw != nil && !ok { return fmt.Errorf("field jws in JsonWebKeyTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in JsonWebKeyTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in JsonWebKeyTestVector: required") } type Plain JsonWebKeyTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = JsonWebKeyTestVector(plain) return nil } type JsonWebKeyUse string const JsonWebKeyUseEnc JsonWebKeyUse = "enc" const JsonWebKeyUseSig JsonWebKeyUse = "sig" var enumValues_JsonWebKeyUse = []interface{}{ "sig", "enc", } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebKeyUse) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_JsonWebKeyUse { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_JsonWebKeyUse, v) } *j = JsonWebKeyUse(v) return nil } // see https://tools.ietf.org/html/rfc7517#section-5 type JsonWebKeyset struct { // Keys corresponds to the JSON schema field "keys". Keys []JsonWebKey `json:"keys,omitempty"` } type JsonWebSignatureSchemaV1Json struct { // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema JsonWebSignatureSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []JsonWebSignatureTestGroup `json:"testGroups"` } type JsonWebSignatureSchemaV1JsonSchema string const JsonWebSignatureSchemaV1JsonSchemaJsonWebSignatureSchemaV1Json JsonWebSignatureSchemaV1JsonSchema = "json_web_signature_schema_v1.json" var enumValues_JsonWebSignatureSchemaV1JsonSchema = []interface{}{ "json_web_signature_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebSignatureSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_JsonWebSignatureSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_JsonWebSignatureSchemaV1JsonSchema, v) } *j = JsonWebSignatureSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebSignatureSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in JsonWebSignatureSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in JsonWebSignatureSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in JsonWebSignatureSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in JsonWebSignatureSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in JsonWebSignatureSchemaV1Json: required") } type Plain JsonWebSignatureSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = JsonWebSignatureSchemaV1Json(plain) return nil } type JsonWebSignatureTestGroup struct { // a description of what these tests have in common Comment *string `json:"comment,omitempty"` // the private or secret key in webcrypto format Private *JsonWebKey `json:"private,omitempty"` // [optional] the public key in webcrypto format Public *JsonWebKey `json:"public,omitempty"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []JsonWebSignatureTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type *JsonWebSignatureTestGroupType `json:"type,omitempty"` } type JsonWebSignatureTestGroupType string const JsonWebSignatureTestGroupTypeJsonWebSignature JsonWebSignatureTestGroupType = "JsonWebSignature" var enumValues_JsonWebSignatureTestGroupType = []interface{}{ "JsonWebSignature", } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebSignatureTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_JsonWebSignatureTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_JsonWebSignatureTestGroupType, v) } *j = JsonWebSignatureTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebSignatureTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in JsonWebSignatureTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in JsonWebSignatureTestGroup: required") } type Plain JsonWebSignatureTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = JsonWebSignatureTestGroup(plain) return nil } type JsonWebSignatureTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // The JSON Web Signature in compact form Jws string `json:"jws"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *JsonWebSignatureTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in JsonWebSignatureTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in JsonWebSignatureTestVector: required") } if _, ok := raw["jws"]; raw != nil && !ok { return fmt.Errorf("field jws in JsonWebSignatureTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in JsonWebSignatureTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in JsonWebSignatureTestVector: required") } type Plain JsonWebSignatureTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = JsonWebSignatureTestVector(plain) return nil } type KeywrapTestGroup struct { // the keySize in bits KeySize int `json:"keySize"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []KeywrapTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type KeywrapTestGroupType `json:"type"` } type KeywrapTestGroupType string const KeywrapTestGroupTypeKeywrapTest KeywrapTestGroupType = "KeywrapTest" var enumValues_KeywrapTestGroupType = []interface{}{ "KeywrapTest", } // UnmarshalJSON implements json.Unmarshaler. func (j *KeywrapTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_KeywrapTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_KeywrapTestGroupType, v) } *j = KeywrapTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *KeywrapTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["keySize"]; raw != nil && !ok { return fmt.Errorf("field keySize in KeywrapTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in KeywrapTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in KeywrapTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in KeywrapTestGroup: required") } type Plain KeywrapTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = KeywrapTestGroup(plain) return nil } type KeywrapTestSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema KeywrapTestSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []KeywrapTestGroup `json:"testGroups"` } type KeywrapTestSchemaV1JsonSchema string const KeywrapTestSchemaV1JsonSchemaKeywrapTestSchemaV1Json KeywrapTestSchemaV1JsonSchema = "keywrap_test_schema_v1.json" var enumValues_KeywrapTestSchemaV1JsonSchema = []interface{}{ "keywrap_test_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *KeywrapTestSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_KeywrapTestSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_KeywrapTestSchemaV1JsonSchema, v) } *j = KeywrapTestSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *KeywrapTestSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in KeywrapTestSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in KeywrapTestSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in KeywrapTestSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in KeywrapTestSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in KeywrapTestSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in KeywrapTestSchemaV1Json: required") } type Plain KeywrapTestSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = KeywrapTestSchemaV1Json(plain) return nil } type KeywrapTestVector struct { // A brief description of the test case Comment string `json:"comment"` // the wrapped key Ct string `json:"ct"` // A list of flags Flags []string `json:"flags"` // the wrapping key Key string `json:"key"` // the key bytes to wrap Msg string `json:"msg"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *KeywrapTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in KeywrapTestVector: required") } if _, ok := raw["ct"]; raw != nil && !ok { return fmt.Errorf("field ct in KeywrapTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in KeywrapTestVector: required") } if _, ok := raw["key"]; raw != nil && !ok { return fmt.Errorf("field key in KeywrapTestVector: required") } if _, ok := raw["msg"]; raw != nil && !ok { return fmt.Errorf("field msg in KeywrapTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in KeywrapTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in KeywrapTestVector: required") } type Plain KeywrapTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = KeywrapTestVector(plain) return nil } // A test for ML-KEM decapsulation validation type MLKEMDecapsTestGroup struct { // ParameterSet corresponds to the JSON schema field "parameterSet". ParameterSet MLKEMDecapsTestGroupParameterSet `json:"parameterSet"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []MLKEMDecapsTestGroupTestsElem `json:"tests"` // Test type for decapsulation validation Type MLKEMDecapsTestGroupType `json:"type"` } type MLKEMDecapsTestGroupParameterSet string const MLKEMDecapsTestGroupParameterSetMLKEM1024 MLKEMDecapsTestGroupParameterSet = "ML-KEM-1024" const MLKEMDecapsTestGroupParameterSetMLKEM512 MLKEMDecapsTestGroupParameterSet = "ML-KEM-512" const MLKEMDecapsTestGroupParameterSetMLKEM768 MLKEMDecapsTestGroupParameterSet = "ML-KEM-768" var enumValues_MLKEMDecapsTestGroupParameterSet = []interface{}{ "ML-KEM-512", "ML-KEM-768", "ML-KEM-1024", } // UnmarshalJSON implements json.Unmarshaler. func (j *MLKEMDecapsTestGroupParameterSet) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MLKEMDecapsTestGroupParameterSet { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MLKEMDecapsTestGroupParameterSet, v) } *j = MLKEMDecapsTestGroupParameterSet(v) return nil } type MLKEMDecapsTestGroupTestsElem struct { // An input ciphertext C string `json:"c"` // A brief description of the test case Comment *string `json:"comment,omitempty"` // The full decapsulation key Dk string `json:"dk"` // A list of flags Flags []string `json:"flags"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *MLKEMDecapsTestGroupTestsElem) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["c"]; raw != nil && !ok { return fmt.Errorf("field c in MLKEMDecapsTestGroupTestsElem: required") } if _, ok := raw["dk"]; raw != nil && !ok { return fmt.Errorf("field dk in MLKEMDecapsTestGroupTestsElem: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in MLKEMDecapsTestGroupTestsElem: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in MLKEMDecapsTestGroupTestsElem: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in MLKEMDecapsTestGroupTestsElem: required") } type Plain MLKEMDecapsTestGroupTestsElem var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MLKEMDecapsTestGroupTestsElem(plain) return nil } type MLKEMDecapsTestGroupType string const MLKEMDecapsTestGroupTypeMLKEMDecapsValidationTest MLKEMDecapsTestGroupType = "MLKEMDecapsValidationTest" var enumValues_MLKEMDecapsTestGroupType = []interface{}{ "MLKEMDecapsValidationTest", } // UnmarshalJSON implements json.Unmarshaler. func (j *MLKEMDecapsTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MLKEMDecapsTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MLKEMDecapsTestGroupType, v) } *j = MLKEMDecapsTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MLKEMDecapsTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["parameterSet"]; raw != nil && !ok { return fmt.Errorf("field parameterSet in MLKEMDecapsTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in MLKEMDecapsTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in MLKEMDecapsTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in MLKEMDecapsTestGroup: required") } type Plain MLKEMDecapsTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MLKEMDecapsTestGroup(plain) return nil } // A test for Encaps type MLKEMEncapsTestGroup struct { // ParameterSet corresponds to the JSON schema field "parameterSet". ParameterSet MLKEMEncapsTestGroupParameterSet `json:"parameterSet"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []MLKEMEncapsTestGroupTestsElem `json:"tests"` // A legacy field, test files contain only one type per file Type *MLKEMEncapsTestGroupType `json:"type,omitempty"` } type MLKEMEncapsTestGroupParameterSet string const MLKEMEncapsTestGroupParameterSetMLKEM1024 MLKEMEncapsTestGroupParameterSet = "ML-KEM-1024" const MLKEMEncapsTestGroupParameterSetMLKEM512 MLKEMEncapsTestGroupParameterSet = "ML-KEM-512" const MLKEMEncapsTestGroupParameterSetMLKEM768 MLKEMEncapsTestGroupParameterSet = "ML-KEM-768" var enumValues_MLKEMEncapsTestGroupParameterSet = []interface{}{ "ML-KEM-512", "ML-KEM-768", "ML-KEM-1024", } // UnmarshalJSON implements json.Unmarshaler. func (j *MLKEMEncapsTestGroupParameterSet) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MLKEMEncapsTestGroupParameterSet { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MLKEMEncapsTestGroupParameterSet, v) } *j = MLKEMEncapsTestGroupParameterSet(v) return nil } type MLKEMEncapsTestGroupTestsElem struct { // The output shared secret K string `json:"K"` // The output ciphertext C string `json:"c"` // A brief description of the test case Comment *string `json:"comment,omitempty"` // The encapsulation key Ek string `json:"ek"` // A list of flags Flags []string `json:"flags"` // The ML-KEM.Encaps_internal m input M string `json:"m"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *MLKEMEncapsTestGroupTestsElem) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["K"]; raw != nil && !ok { return fmt.Errorf("field K in MLKEMEncapsTestGroupTestsElem: required") } if _, ok := raw["c"]; raw != nil && !ok { return fmt.Errorf("field c in MLKEMEncapsTestGroupTestsElem: required") } if _, ok := raw["ek"]; raw != nil && !ok { return fmt.Errorf("field ek in MLKEMEncapsTestGroupTestsElem: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in MLKEMEncapsTestGroupTestsElem: required") } if _, ok := raw["m"]; raw != nil && !ok { return fmt.Errorf("field m in MLKEMEncapsTestGroupTestsElem: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in MLKEMEncapsTestGroupTestsElem: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in MLKEMEncapsTestGroupTestsElem: required") } type Plain MLKEMEncapsTestGroupTestsElem var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MLKEMEncapsTestGroupTestsElem(plain) return nil } type MLKEMEncapsTestGroupType string const MLKEMEncapsTestGroupTypeMLKEMEncapsTest MLKEMEncapsTestGroupType = "MLKEMEncapsTest" var enumValues_MLKEMEncapsTestGroupType = []interface{}{ "MLKEMEncapsTest", } // UnmarshalJSON implements json.Unmarshaler. func (j *MLKEMEncapsTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MLKEMEncapsTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MLKEMEncapsTestGroupType, v) } *j = MLKEMEncapsTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MLKEMEncapsTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["parameterSet"]; raw != nil && !ok { return fmt.Errorf("field parameterSet in MLKEMEncapsTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in MLKEMEncapsTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in MLKEMEncapsTestGroup: required") } type Plain MLKEMEncapsTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MLKEMEncapsTestGroup(plain) return nil } // A test for KeyGen using seed format type MLKEMKeyGenTestGroup struct { // ParameterSet corresponds to the JSON schema field "parameterSet". ParameterSet MLKEMKeyGenTestGroupParameterSet `json:"parameterSet"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []MLKEMKeyGenTestGroupTestsElem `json:"tests"` // Type corresponds to the JSON schema field "type". Type MLKEMKeyGenTestGroupType `json:"type"` } type MLKEMKeyGenTestGroupParameterSet string const MLKEMKeyGenTestGroupParameterSetMLKEM1024 MLKEMKeyGenTestGroupParameterSet = "ML-KEM-1024" const MLKEMKeyGenTestGroupParameterSetMLKEM512 MLKEMKeyGenTestGroupParameterSet = "ML-KEM-512" const MLKEMKeyGenTestGroupParameterSetMLKEM768 MLKEMKeyGenTestGroupParameterSet = "ML-KEM-768" var enumValues_MLKEMKeyGenTestGroupParameterSet = []interface{}{ "ML-KEM-512", "ML-KEM-768", "ML-KEM-1024", } // UnmarshalJSON implements json.Unmarshaler. func (j *MLKEMKeyGenTestGroupParameterSet) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MLKEMKeyGenTestGroupParameterSet { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MLKEMKeyGenTestGroupParameterSet, v) } *j = MLKEMKeyGenTestGroupParameterSet(v) return nil } type MLKEMKeyGenTestGroupTestsElem struct { // A brief description of the test case Comment *string `json:"comment,omitempty"` // The expected expanded decapsulation key Dk string `json:"dk"` // The expected encapsulation key Ek string `json:"ek"` // A list of flags Flags []string `json:"flags,omitempty"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // The d || z seed for key generation Seed string `json:"seed"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *MLKEMKeyGenTestGroupTestsElem) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["dk"]; raw != nil && !ok { return fmt.Errorf("field dk in MLKEMKeyGenTestGroupTestsElem: required") } if _, ok := raw["ek"]; raw != nil && !ok { return fmt.Errorf("field ek in MLKEMKeyGenTestGroupTestsElem: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in MLKEMKeyGenTestGroupTestsElem: required") } if _, ok := raw["seed"]; raw != nil && !ok { return fmt.Errorf("field seed in MLKEMKeyGenTestGroupTestsElem: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in MLKEMKeyGenTestGroupTestsElem: required") } type Plain MLKEMKeyGenTestGroupTestsElem var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MLKEMKeyGenTestGroupTestsElem(plain) return nil } type MLKEMKeyGenTestGroupType string const MLKEMKeyGenTestGroupTypeMLKEMKeyGen MLKEMKeyGenTestGroupType = "MLKEMKeyGen" var enumValues_MLKEMKeyGenTestGroupType = []interface{}{ "MLKEMKeyGen", } // UnmarshalJSON implements json.Unmarshaler. func (j *MLKEMKeyGenTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MLKEMKeyGenTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MLKEMKeyGenTestGroupType, v) } *j = MLKEMKeyGenTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MLKEMKeyGenTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["parameterSet"]; raw != nil && !ok { return fmt.Errorf("field parameterSet in MLKEMKeyGenTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in MLKEMKeyGenTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in MLKEMKeyGenTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in MLKEMKeyGenTestGroup: required") } type Plain MLKEMKeyGenTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MLKEMKeyGenTestGroup(plain) return nil } // A test for KeyGen and/or Decaps type MLKEMTestGroup struct { // ParameterSet corresponds to the JSON schema field "parameterSet". ParameterSet MLKEMTestGroupParameterSet `json:"parameterSet"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []MLKEMTestGroupTestsElem `json:"tests"` // A legacy field, test files contain only one type per file Type MLKEMTestGroupType `json:"type"` } type MLKEMTestGroupParameterSet string const MLKEMTestGroupParameterSetMLKEM1024 MLKEMTestGroupParameterSet = "ML-KEM-1024" const MLKEMTestGroupParameterSetMLKEM512 MLKEMTestGroupParameterSet = "ML-KEM-512" const MLKEMTestGroupParameterSetMLKEM768 MLKEMTestGroupParameterSet = "ML-KEM-768" var enumValues_MLKEMTestGroupParameterSet = []interface{}{ "ML-KEM-512", "ML-KEM-768", "ML-KEM-1024", } // UnmarshalJSON implements json.Unmarshaler. func (j *MLKEMTestGroupParameterSet) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MLKEMTestGroupParameterSet { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MLKEMTestGroupParameterSet, v) } *j = MLKEMTestGroupParameterSet(v) return nil } type MLKEMTestGroupTestsElem struct { // The output shared secret K string `json:"K"` // An input ciphertext C string `json:"c"` // A brief description of the test case Comment *string `json:"comment,omitempty"` // The encapsulation key derived from the seed Ek *string `json:"ek,omitempty"` // A list of flags Flags []string `json:"flags"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // The d || z seed Seed string `json:"seed"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *MLKEMTestGroupTestsElem) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["K"]; raw != nil && !ok { return fmt.Errorf("field K in MLKEMTestGroupTestsElem: required") } if _, ok := raw["c"]; raw != nil && !ok { return fmt.Errorf("field c in MLKEMTestGroupTestsElem: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in MLKEMTestGroupTestsElem: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in MLKEMTestGroupTestsElem: required") } if _, ok := raw["seed"]; raw != nil && !ok { return fmt.Errorf("field seed in MLKEMTestGroupTestsElem: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in MLKEMTestGroupTestsElem: required") } type Plain MLKEMTestGroupTestsElem var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MLKEMTestGroupTestsElem(plain) return nil } type MLKEMTestGroupType string const MLKEMTestGroupTypeMLKEMTest MLKEMTestGroupType = "MLKEMTest" var enumValues_MLKEMTestGroupType = []interface{}{ "MLKEMTest", } // UnmarshalJSON implements json.Unmarshaler. func (j *MLKEMTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MLKEMTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MLKEMTestGroupType, v) } *j = MLKEMTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MLKEMTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["parameterSet"]; raw != nil && !ok { return fmt.Errorf("field parameterSet in MLKEMTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in MLKEMTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in MLKEMTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in MLKEMTestGroup: required") } type Plain MLKEMTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MLKEMTestGroup(plain) return nil } type MacTestGroup struct { // the keySize in bits KeySize int `json:"keySize"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // the expected size of the tag in bits TagSize int `json:"tagSize"` // Tests corresponds to the JSON schema field "tests". Tests []MacTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type MacTestGroupType `json:"type"` } type MacTestGroupType string const MacTestGroupTypeMacTest MacTestGroupType = "MacTest" var enumValues_MacTestGroupType = []interface{}{ "MacTest", } // UnmarshalJSON implements json.Unmarshaler. func (j *MacTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MacTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MacTestGroupType, v) } *j = MacTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MacTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["keySize"]; raw != nil && !ok { return fmt.Errorf("field keySize in MacTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in MacTestGroup: required") } if _, ok := raw["tagSize"]; raw != nil && !ok { return fmt.Errorf("field tagSize in MacTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in MacTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in MacTestGroup: required") } type Plain MacTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MacTestGroup(plain) return nil } type MacTestSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema MacTestSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []MacTestGroup `json:"testGroups"` } type MacTestSchemaV1JsonSchema string const MacTestSchemaV1JsonSchemaMacTestSchemaV1Json MacTestSchemaV1JsonSchema = "mac_test_schema_v1.json" var enumValues_MacTestSchemaV1JsonSchema = []interface{}{ "mac_test_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *MacTestSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MacTestSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MacTestSchemaV1JsonSchema, v) } *j = MacTestSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MacTestSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in MacTestSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in MacTestSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in MacTestSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in MacTestSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in MacTestSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in MacTestSchemaV1Json: required") } type Plain MacTestSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MacTestSchemaV1Json(plain) return nil } type MacTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // the key Key string `json:"key"` // the plaintext Msg string `json:"msg"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // the authentication tag Tag string `json:"tag"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *MacTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in MacTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in MacTestVector: required") } if _, ok := raw["key"]; raw != nil && !ok { return fmt.Errorf("field key in MacTestVector: required") } if _, ok := raw["msg"]; raw != nil && !ok { return fmt.Errorf("field msg in MacTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in MacTestVector: required") } if _, ok := raw["tag"]; raw != nil && !ok { return fmt.Errorf("field tag in MacTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in MacTestVector: required") } type Plain MacTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MacTestVector(plain) return nil } type MacWithIvTestGroup struct { // the IV size in bits IvSize int `json:"ivSize"` // the key size in bits KeySize int `json:"keySize"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // the expected size of the tag in bits TagSize int `json:"tagSize"` // Tests corresponds to the JSON schema field "tests". Tests []MacWithIvTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type MacWithIvTestGroupType `json:"type"` } type MacWithIvTestGroupType string const MacWithIvTestGroupTypeMacWithIvTest MacWithIvTestGroupType = "MacWithIvTest" var enumValues_MacWithIvTestGroupType = []interface{}{ "MacWithIvTest", } // UnmarshalJSON implements json.Unmarshaler. func (j *MacWithIvTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MacWithIvTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MacWithIvTestGroupType, v) } *j = MacWithIvTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MacWithIvTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["ivSize"]; raw != nil && !ok { return fmt.Errorf("field ivSize in MacWithIvTestGroup: required") } if _, ok := raw["keySize"]; raw != nil && !ok { return fmt.Errorf("field keySize in MacWithIvTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in MacWithIvTestGroup: required") } if _, ok := raw["tagSize"]; raw != nil && !ok { return fmt.Errorf("field tagSize in MacWithIvTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in MacWithIvTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in MacWithIvTestGroup: required") } type Plain MacWithIvTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MacWithIvTestGroup(plain) return nil } type MacWithIvTestSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema MacWithIvTestSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []MacWithIvTestGroup `json:"testGroups"` } type MacWithIvTestSchemaV1JsonSchema string const MacWithIvTestSchemaV1JsonSchemaMacWithIvTestSchemaV1Json MacWithIvTestSchemaV1JsonSchema = "mac_with_iv_test_schema_v1.json" var enumValues_MacWithIvTestSchemaV1JsonSchema = []interface{}{ "mac_with_iv_test_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *MacWithIvTestSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MacWithIvTestSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MacWithIvTestSchemaV1JsonSchema, v) } *j = MacWithIvTestSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MacWithIvTestSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in MacWithIvTestSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in MacWithIvTestSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in MacWithIvTestSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in MacWithIvTestSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in MacWithIvTestSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in MacWithIvTestSchemaV1Json: required") } type Plain MacWithIvTestSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MacWithIvTestSchemaV1Json(plain) return nil } type MacWithIvTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // the initialisation vector Iv string `json:"iv"` // the key Key string `json:"key"` // the plaintext Msg string `json:"msg"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // the authentication tag Tag string `json:"tag"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *MacWithIvTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in MacWithIvTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in MacWithIvTestVector: required") } if _, ok := raw["iv"]; raw != nil && !ok { return fmt.Errorf("field iv in MacWithIvTestVector: required") } if _, ok := raw["key"]; raw != nil && !ok { return fmt.Errorf("field key in MacWithIvTestVector: required") } if _, ok := raw["msg"]; raw != nil && !ok { return fmt.Errorf("field msg in MacWithIvTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in MacWithIvTestVector: required") } if _, ok := raw["tag"]; raw != nil && !ok { return fmt.Errorf("field tag in MacWithIvTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in MacWithIvTestVector: required") } type Plain MacWithIvTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MacWithIvTestVector(plain) return nil } type MlDsaSignNoSeedTestGroup struct { // Encoded ML-DSA private key PrivateKey string `json:"privateKey"` // Encoded ML-DSA public key derived from the private key, or null if the private // key is invalid PublicKey interface{} `json:"publicKey"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []MlDsaSignTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type MlDsaSignNoSeedTestGroupType `json:"type"` } type MlDsaSignNoSeedTestGroupType string const MlDsaSignNoSeedTestGroupTypeMlDsaSign MlDsaSignNoSeedTestGroupType = "MlDsaSign" var enumValues_MlDsaSignNoSeedTestGroupType = []interface{}{ "MlDsaSign", } // UnmarshalJSON implements json.Unmarshaler. func (j *MlDsaSignNoSeedTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MlDsaSignNoSeedTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MlDsaSignNoSeedTestGroupType, v) } *j = MlDsaSignNoSeedTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MlDsaSignNoSeedTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["privateKey"]; raw != nil && !ok { return fmt.Errorf("field privateKey in MlDsaSignNoSeedTestGroup: required") } if _, ok := raw["publicKey"]; raw != nil && !ok { return fmt.Errorf("field publicKey in MlDsaSignNoSeedTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in MlDsaSignNoSeedTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in MlDsaSignNoSeedTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in MlDsaSignNoSeedTestGroup: required") } type Plain MlDsaSignNoSeedTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MlDsaSignNoSeedTestGroup(plain) return nil } type MlDsaSignTestGroup struct { // Private key as a DER-encoded PrivateKeyInfo, using the seed form PrivateKeyPkcs8 *string `json:"privateKeyPkcs8,omitempty"` // 32-byte seed that generated the private key PrivateSeed string `json:"privateSeed"` // Encoded ML-DSA public key derived from the private seed, or null if the private // seed is invalid PublicKey interface{} `json:"publicKey"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []MlDsaSignTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type MlDsaSignTestGroupType `json:"type"` } type MlDsaSignTestGroupType string const MlDsaSignTestGroupTypeMlDsaSign MlDsaSignTestGroupType = "MlDsaSign" var enumValues_MlDsaSignTestGroupType = []interface{}{ "MlDsaSign", } // UnmarshalJSON implements json.Unmarshaler. func (j *MlDsaSignTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MlDsaSignTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MlDsaSignTestGroupType, v) } *j = MlDsaSignTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MlDsaSignTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["privateSeed"]; raw != nil && !ok { return fmt.Errorf("field privateSeed in MlDsaSignTestGroup: required") } if _, ok := raw["publicKey"]; raw != nil && !ok { return fmt.Errorf("field publicKey in MlDsaSignTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in MlDsaSignTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in MlDsaSignTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in MlDsaSignTestGroup: required") } type Plain MlDsaSignTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MlDsaSignTestGroup(plain) return nil } type MlDsaSignTestVector interface{} type MlDsaVerifyTestGroup struct { // Encoded ML-DSA public key PublicKey string `json:"publicKey"` // Public key as a DER-encoded SubjectPublicKeyInfo PublicKeyDer string `json:"publicKeyDer"` // Source corresponds to the JSON schema field "source". Source *Source `json:"source,omitempty"` // Tests corresponds to the JSON schema field "tests". Tests []MlDsaVerifyTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type MlDsaVerifyTestGroupType `json:"type"` } type MlDsaVerifyTestGroupType string const MlDsaVerifyTestGroupTypeMlDsaVerify MlDsaVerifyTestGroupType = "MlDsaVerify" var enumValues_MlDsaVerifyTestGroupType = []interface{}{ "MlDsaVerify", } // UnmarshalJSON implements json.Unmarshaler. func (j *MlDsaVerifyTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MlDsaVerifyTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MlDsaVerifyTestGroupType, v) } *j = MlDsaVerifyTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MlDsaVerifyTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["publicKey"]; raw != nil && !ok { return fmt.Errorf("field publicKey in MlDsaVerifyTestGroup: required") } if _, ok := raw["publicKeyDer"]; raw != nil && !ok { return fmt.Errorf("field publicKeyDer in MlDsaVerifyTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in MlDsaVerifyTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in MlDsaVerifyTestGroup: required") } type Plain MlDsaVerifyTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MlDsaVerifyTestGroup(plain) return nil } type MlDsaVerifyTestVector struct { // A brief description of the test case Comment string `json:"comment"` // [optional] The additional context string (empty if not provided) Ctx *string `json:"ctx,omitempty"` // A list of flags Flags []string `json:"flags"` // The message to verify Msg string `json:"msg"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // The encoded signature Sig string `json:"sig"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *MlDsaVerifyTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in MlDsaVerifyTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in MlDsaVerifyTestVector: required") } if _, ok := raw["msg"]; raw != nil && !ok { return fmt.Errorf("field msg in MlDsaVerifyTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in MlDsaVerifyTestVector: required") } if _, ok := raw["sig"]; raw != nil && !ok { return fmt.Errorf("field sig in MlDsaVerifyTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in MlDsaVerifyTestVector: required") } type Plain MlDsaVerifyTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MlDsaVerifyTestVector(plain) return nil } type MldsaSignNoseedSchemaJson struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema MldsaSignNoseedSchemaJsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []MlDsaSignNoSeedTestGroup `json:"testGroups"` } type MldsaSignNoseedSchemaJsonSchema string const MldsaSignNoseedSchemaJsonSchemaMldsaSignNoseedSchemaJson MldsaSignNoseedSchemaJsonSchema = "mldsa_sign_noseed_schema.json" var enumValues_MldsaSignNoseedSchemaJsonSchema = []interface{}{ "mldsa_sign_noseed_schema.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *MldsaSignNoseedSchemaJsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MldsaSignNoseedSchemaJsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MldsaSignNoseedSchemaJsonSchema, v) } *j = MldsaSignNoseedSchemaJsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MldsaSignNoseedSchemaJson) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in MldsaSignNoseedSchemaJson: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in MldsaSignNoseedSchemaJson: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in MldsaSignNoseedSchemaJson: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in MldsaSignNoseedSchemaJson: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in MldsaSignNoseedSchemaJson: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in MldsaSignNoseedSchemaJson: required") } type Plain MldsaSignNoseedSchemaJson var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MldsaSignNoseedSchemaJson(plain) return nil } type MldsaSignSeedSchemaJson struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema MldsaSignSeedSchemaJsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []MlDsaSignTestGroup `json:"testGroups"` } type MldsaSignSeedSchemaJsonSchema string const MldsaSignSeedSchemaJsonSchemaMldsaSignSeedSchemaJson MldsaSignSeedSchemaJsonSchema = "mldsa_sign_seed_schema.json" var enumValues_MldsaSignSeedSchemaJsonSchema = []interface{}{ "mldsa_sign_seed_schema.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *MldsaSignSeedSchemaJsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MldsaSignSeedSchemaJsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MldsaSignSeedSchemaJsonSchema, v) } *j = MldsaSignSeedSchemaJsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MldsaSignSeedSchemaJson) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in MldsaSignSeedSchemaJson: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in MldsaSignSeedSchemaJson: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in MldsaSignSeedSchemaJson: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in MldsaSignSeedSchemaJson: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in MldsaSignSeedSchemaJson: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in MldsaSignSeedSchemaJson: required") } type Plain MldsaSignSeedSchemaJson var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MldsaSignSeedSchemaJson(plain) return nil } type MldsaVerifySchemaJson struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema MldsaVerifySchemaJsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []MlDsaVerifyTestGroup `json:"testGroups"` } type MldsaVerifySchemaJsonSchema string const MldsaVerifySchemaJsonSchemaMldsaVerifySchemaJson MldsaVerifySchemaJsonSchema = "mldsa_verify_schema.json" var enumValues_MldsaVerifySchemaJsonSchema = []interface{}{ "mldsa_verify_schema.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *MldsaVerifySchemaJsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MldsaVerifySchemaJsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MldsaVerifySchemaJsonSchema, v) } *j = MldsaVerifySchemaJsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MldsaVerifySchemaJson) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in MldsaVerifySchemaJson: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in MldsaVerifySchemaJson: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in MldsaVerifySchemaJson: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in MldsaVerifySchemaJson: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in MldsaVerifySchemaJson: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in MldsaVerifySchemaJson: required") } type Plain MldsaVerifySchemaJson var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MldsaVerifySchemaJson(plain) return nil } type MlkemEncapsTestSchemaJson struct { // Algorithm corresponds to the JSON schema field "algorithm". Algorithm MlkemEncapsTestSchemaJsonAlgorithm `json:"algorithm"` // additional documentation Header []string `json:"header,omitempty"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes,omitempty"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema MlkemEncapsTestSchemaJsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []MLKEMEncapsTestGroup `json:"testGroups"` } type MlkemEncapsTestSchemaJsonAlgorithm string const MlkemEncapsTestSchemaJsonAlgorithmMLKEM MlkemEncapsTestSchemaJsonAlgorithm = "ML-KEM" var enumValues_MlkemEncapsTestSchemaJsonAlgorithm = []interface{}{ "ML-KEM", } // UnmarshalJSON implements json.Unmarshaler. func (j *MlkemEncapsTestSchemaJsonAlgorithm) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MlkemEncapsTestSchemaJsonAlgorithm { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MlkemEncapsTestSchemaJsonAlgorithm, v) } *j = MlkemEncapsTestSchemaJsonAlgorithm(v) return nil } type MlkemEncapsTestSchemaJsonSchema string const MlkemEncapsTestSchemaJsonSchemaMlkemEncapsTestSchemaJson MlkemEncapsTestSchemaJsonSchema = "mlkem_encaps_test_schema.json" var enumValues_MlkemEncapsTestSchemaJsonSchema = []interface{}{ "mlkem_encaps_test_schema.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *MlkemEncapsTestSchemaJsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MlkemEncapsTestSchemaJsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MlkemEncapsTestSchemaJsonSchema, v) } *j = MlkemEncapsTestSchemaJsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MlkemEncapsTestSchemaJson) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in MlkemEncapsTestSchemaJson: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in MlkemEncapsTestSchemaJson: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in MlkemEncapsTestSchemaJson: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in MlkemEncapsTestSchemaJson: required") } type Plain MlkemEncapsTestSchemaJson var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MlkemEncapsTestSchemaJson(plain) return nil } type MlkemKeygenSeedTestSchemaJson struct { // Algorithm corresponds to the JSON schema field "algorithm". Algorithm MlkemKeygenSeedTestSchemaJsonAlgorithm `json:"algorithm"` // additional documentation Header []string `json:"header,omitempty"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes,omitempty"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema MlkemKeygenSeedTestSchemaJsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []MLKEMKeyGenTestGroup `json:"testGroups"` } type MlkemKeygenSeedTestSchemaJsonAlgorithm string const MlkemKeygenSeedTestSchemaJsonAlgorithmMLKEM MlkemKeygenSeedTestSchemaJsonAlgorithm = "ML-KEM" var enumValues_MlkemKeygenSeedTestSchemaJsonAlgorithm = []interface{}{ "ML-KEM", } // UnmarshalJSON implements json.Unmarshaler. func (j *MlkemKeygenSeedTestSchemaJsonAlgorithm) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MlkemKeygenSeedTestSchemaJsonAlgorithm { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MlkemKeygenSeedTestSchemaJsonAlgorithm, v) } *j = MlkemKeygenSeedTestSchemaJsonAlgorithm(v) return nil } type MlkemKeygenSeedTestSchemaJsonSchema string const MlkemKeygenSeedTestSchemaJsonSchemaMlkemKeygenSeedTestSchemaJson MlkemKeygenSeedTestSchemaJsonSchema = "mlkem_keygen_seed_test_schema.json" var enumValues_MlkemKeygenSeedTestSchemaJsonSchema = []interface{}{ "mlkem_keygen_seed_test_schema.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *MlkemKeygenSeedTestSchemaJsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MlkemKeygenSeedTestSchemaJsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MlkemKeygenSeedTestSchemaJsonSchema, v) } *j = MlkemKeygenSeedTestSchemaJsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MlkemKeygenSeedTestSchemaJson) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in MlkemKeygenSeedTestSchemaJson: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in MlkemKeygenSeedTestSchemaJson: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in MlkemKeygenSeedTestSchemaJson: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in MlkemKeygenSeedTestSchemaJson: required") } type Plain MlkemKeygenSeedTestSchemaJson var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MlkemKeygenSeedTestSchemaJson(plain) return nil } type MlkemSemiExpandedDecapsTestSchemaJson struct { // Algorithm corresponds to the JSON schema field "algorithm". Algorithm MlkemSemiExpandedDecapsTestSchemaJsonAlgorithm `json:"algorithm"` // additional documentation Header []string `json:"header,omitempty"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes,omitempty"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema MlkemSemiExpandedDecapsTestSchemaJsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []MLKEMDecapsTestGroup `json:"testGroups"` } type MlkemSemiExpandedDecapsTestSchemaJsonAlgorithm string const MlkemSemiExpandedDecapsTestSchemaJsonAlgorithmMLKEM MlkemSemiExpandedDecapsTestSchemaJsonAlgorithm = "ML-KEM" var enumValues_MlkemSemiExpandedDecapsTestSchemaJsonAlgorithm = []interface{}{ "ML-KEM", } // UnmarshalJSON implements json.Unmarshaler. func (j *MlkemSemiExpandedDecapsTestSchemaJsonAlgorithm) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MlkemSemiExpandedDecapsTestSchemaJsonAlgorithm { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MlkemSemiExpandedDecapsTestSchemaJsonAlgorithm, v) } *j = MlkemSemiExpandedDecapsTestSchemaJsonAlgorithm(v) return nil } type MlkemSemiExpandedDecapsTestSchemaJsonSchema string const MlkemSemiExpandedDecapsTestSchemaJsonSchemaMlkemSemiExpandedDecapsTestSchemaJson MlkemSemiExpandedDecapsTestSchemaJsonSchema = "mlkem_semi_expanded_decaps_test_schema.json" var enumValues_MlkemSemiExpandedDecapsTestSchemaJsonSchema = []interface{}{ "mlkem_semi_expanded_decaps_test_schema.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *MlkemSemiExpandedDecapsTestSchemaJsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MlkemSemiExpandedDecapsTestSchemaJsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MlkemSemiExpandedDecapsTestSchemaJsonSchema, v) } *j = MlkemSemiExpandedDecapsTestSchemaJsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MlkemSemiExpandedDecapsTestSchemaJson) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in MlkemSemiExpandedDecapsTestSchemaJson: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in MlkemSemiExpandedDecapsTestSchemaJson: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in MlkemSemiExpandedDecapsTestSchemaJson: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in MlkemSemiExpandedDecapsTestSchemaJson: required") } type Plain MlkemSemiExpandedDecapsTestSchemaJson var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MlkemSemiExpandedDecapsTestSchemaJson(plain) return nil } type MlkemTestSchemaJson struct { // Algorithm corresponds to the JSON schema field "algorithm". Algorithm MlkemTestSchemaJsonAlgorithm `json:"algorithm"` // additional documentation Header []string `json:"header,omitempty"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes,omitempty"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema MlkemTestSchemaJsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []MLKEMTestGroup `json:"testGroups"` } type MlkemTestSchemaJsonAlgorithm string const MlkemTestSchemaJsonAlgorithmMLKEM MlkemTestSchemaJsonAlgorithm = "ML-KEM" var enumValues_MlkemTestSchemaJsonAlgorithm = []interface{}{ "ML-KEM", } // UnmarshalJSON implements json.Unmarshaler. func (j *MlkemTestSchemaJsonAlgorithm) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MlkemTestSchemaJsonAlgorithm { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MlkemTestSchemaJsonAlgorithm, v) } *j = MlkemTestSchemaJsonAlgorithm(v) return nil } type MlkemTestSchemaJsonSchema string const MlkemTestSchemaJsonSchemaMlkemTestSchemaJson MlkemTestSchemaJsonSchema = "mlkem_test_schema.json" var enumValues_MlkemTestSchemaJsonSchema = []interface{}{ "mlkem_test_schema.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *MlkemTestSchemaJsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_MlkemTestSchemaJsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MlkemTestSchemaJsonSchema, v) } *j = MlkemTestSchemaJsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *MlkemTestSchemaJson) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in MlkemTestSchemaJson: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in MlkemTestSchemaJson: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in MlkemTestSchemaJson: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in MlkemTestSchemaJson: required") } type Plain MlkemTestSchemaJson var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = MlkemTestSchemaJson(plain) return nil } type NoteEntry struct { // The type of the bug tested for BugType string `json:"bugType"` // A list of potentially related CVEs Cves []string `json:"cves,omitempty"` // A description of the flag Description *string `json:"description,omitempty"` // The expected effect of failing the test vector Effect *string `json:"effect,omitempty"` // A list of potentially related references Links []string `json:"links,omitempty"` } // UnmarshalJSON implements json.Unmarshaler. func (j *NoteEntry) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["bugType"]; raw != nil && !ok { return fmt.Errorf("field bugType in NoteEntry: required") } type Plain NoteEntry var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = NoteEntry(plain) return nil } type Notes map[string]NoteEntry type PrimalityTestGroup struct { // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []PrimalityTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type PrimalityTestGroupType `json:"type"` } type PrimalityTestGroupType string const PrimalityTestGroupTypePrimalityTest PrimalityTestGroupType = "PrimalityTest" var enumValues_PrimalityTestGroupType = []interface{}{ "PrimalityTest", } // UnmarshalJSON implements json.Unmarshaler. func (j *PrimalityTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_PrimalityTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_PrimalityTestGroupType, v) } *j = PrimalityTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *PrimalityTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in PrimalityTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in PrimalityTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in PrimalityTestGroup: required") } type Plain PrimalityTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = PrimalityTestGroup(plain) return nil } type PrimalityTestSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema PrimalityTestSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []PrimalityTestGroup `json:"testGroups"` } type PrimalityTestSchemaV1JsonSchema string const PrimalityTestSchemaV1JsonSchemaPrimalityTestSchemaV1Json PrimalityTestSchemaV1JsonSchema = "primality_test_schema_v1.json" var enumValues_PrimalityTestSchemaV1JsonSchema = []interface{}{ "primality_test_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *PrimalityTestSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_PrimalityTestSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_PrimalityTestSchemaV1JsonSchema, v) } *j = PrimalityTestSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *PrimalityTestSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in PrimalityTestSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in PrimalityTestSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in PrimalityTestSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in PrimalityTestSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in PrimalityTestSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in PrimalityTestSchemaV1Json: required") } type Plain PrimalityTestSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = PrimalityTestSchemaV1Json(plain) return nil } type PrimalityTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // Identifier of the test case TcId int `json:"tcId"` // the integer to test Value string `json:"value"` } // UnmarshalJSON implements json.Unmarshaler. func (j *PrimalityTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in PrimalityTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in PrimalityTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in PrimalityTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in PrimalityTestVector: required") } if _, ok := raw["value"]; raw != nil && !ok { return fmt.Errorf("field value in PrimalityTestVector: required") } type Plain PrimalityTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = PrimalityTestVector(plain) return nil } type PrivateKey struct { // Coefficient corresponds to the JSON schema field "coefficient". Coefficient *string `json:"coefficient,omitempty"` // Exponent1 corresponds to the JSON schema field "exponent1". Exponent1 *string `json:"exponent1,omitempty"` // Exponent2 corresponds to the JSON schema field "exponent2". Exponent2 *string `json:"exponent2,omitempty"` // Modulus corresponds to the JSON schema field "modulus". Modulus string `json:"modulus"` // OtherPrimeInfos corresponds to the JSON schema field "otherPrimeInfos". OtherPrimeInfos [][]string `json:"otherPrimeInfos,omitempty"` // Prime1 corresponds to the JSON schema field "prime1". Prime1 *string `json:"prime1,omitempty"` // Prime2 corresponds to the JSON schema field "prime2". Prime2 *string `json:"prime2,omitempty"` // PrivateExponent corresponds to the JSON schema field "privateExponent". PrivateExponent string `json:"privateExponent"` // PublicExponent corresponds to the JSON schema field "publicExponent". PublicExponent string `json:"publicExponent"` } // UnmarshalJSON implements json.Unmarshaler. func (j *PrivateKey) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["modulus"]; raw != nil && !ok { return fmt.Errorf("field modulus in PrivateKey: required") } if _, ok := raw["privateExponent"]; raw != nil && !ok { return fmt.Errorf("field privateExponent in PrivateKey: required") } if _, ok := raw["publicExponent"]; raw != nil && !ok { return fmt.Errorf("field publicExponent in PrivateKey: required") } type Plain PrivateKey var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = PrivateKey(plain) return nil } type PublicKey struct { // the name of the curve Curve string `json:"curve"` // the size of the key in bits KeySize int `json:"keySize"` // the public key Pk string `json:"pk"` // Type corresponds to the JSON schema field "type". Type PublicKeyType `json:"type"` } type PublicKeyType string const PublicKeyTypeECDSAPublicKey PublicKeyType = "ECDSAPublicKey" const PublicKeyTypeEDDSAPublicKey PublicKeyType = "EDDSAPublicKey" var enumValues_PublicKeyType = []interface{}{ "ECDSAPublicKey", "EDDSAPublicKey", } // UnmarshalJSON implements json.Unmarshaler. func (j *PublicKeyType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_PublicKeyType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_PublicKeyType, v) } *j = PublicKeyType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *PublicKey) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["curve"]; raw != nil && !ok { return fmt.Errorf("field curve in PublicKey: required") } if _, ok := raw["keySize"]; raw != nil && !ok { return fmt.Errorf("field keySize in PublicKey: required") } if _, ok := raw["pk"]; raw != nil && !ok { return fmt.Errorf("field pk in PublicKey: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in PublicKey: required") } type Plain PublicKey var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = PublicKey(plain) return nil } // Recipient specific information Section 7.2.1 of RFC 7516 type Recipient struct { // EncryptedKey corresponds to the JSON schema field "encrypted_key". EncryptedKey *string `json:"encrypted_key,omitempty"` // header information that is not integrity protected Header RecipientHeader `json:"header,omitempty"` } // header information that is not integrity protected type RecipientHeader map[string]interface{} type Result string const ResultAcceptable Result = "acceptable" const ResultInvalid Result = "invalid" const ResultValid Result = "valid" var enumValues_Result = []interface{}{ "valid", "invalid", "acceptable", } // UnmarshalJSON implements json.Unmarshaler. func (j *Result) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_Result { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Result, v) } *j = Result(v) return nil } type RsaesOaepDecryptSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema RsaesOaepDecryptSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []RsaesOaepTestGroup `json:"testGroups"` } type RsaesOaepDecryptSchemaV1JsonSchema string const RsaesOaepDecryptSchemaV1JsonSchemaRsaesOaepDecryptSchemaV1Json RsaesOaepDecryptSchemaV1JsonSchema = "rsaes_oaep_decrypt_schema_v1.json" var enumValues_RsaesOaepDecryptSchemaV1JsonSchema = []interface{}{ "rsaes_oaep_decrypt_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *RsaesOaepDecryptSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_RsaesOaepDecryptSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_RsaesOaepDecryptSchemaV1JsonSchema, v) } *j = RsaesOaepDecryptSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *RsaesOaepDecryptSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in RsaesOaepDecryptSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in RsaesOaepDecryptSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in RsaesOaepDecryptSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in RsaesOaepDecryptSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in RsaesOaepDecryptSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in RsaesOaepDecryptSchemaV1Json: required") } type Plain RsaesOaepDecryptSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = RsaesOaepDecryptSchemaV1Json(plain) return nil } type RsaesOaepTestGroup struct { // the keySize in bits KeySize int `json:"keySize"` // the message generating function (e.g. MGF1) Mgf string `json:"mgf"` // The hash function used for the message generating function. MgfSha string `json:"mgfSha"` // PrivateKey corresponds to the JSON schema field "privateKey". PrivateKey PrivateKey `json:"privateKey"` // PrivateKeyJwk corresponds to the JSON schema field "privateKeyJwk". PrivateKeyJwk *JsonWebKey `json:"privateKeyJwk,omitempty"` // Pem encoded private key PrivateKeyPem string `json:"privateKeyPem"` // Pkcs 8 encoded private key. PrivateKeyPkcs8 string `json:"privateKeyPkcs8"` // The hash function for hashing the label. Sha string `json:"sha"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []RsaesOaepTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type RsaesOaepTestGroupType `json:"type"` } type RsaesOaepTestGroupType string const RsaesOaepTestGroupTypeRsaesOaepDecrypt RsaesOaepTestGroupType = "RsaesOaepDecrypt" var enumValues_RsaesOaepTestGroupType = []interface{}{ "RsaesOaepDecrypt", } // UnmarshalJSON implements json.Unmarshaler. func (j *RsaesOaepTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_RsaesOaepTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_RsaesOaepTestGroupType, v) } *j = RsaesOaepTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *RsaesOaepTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["keySize"]; raw != nil && !ok { return fmt.Errorf("field keySize in RsaesOaepTestGroup: required") } if _, ok := raw["mgf"]; raw != nil && !ok { return fmt.Errorf("field mgf in RsaesOaepTestGroup: required") } if _, ok := raw["mgfSha"]; raw != nil && !ok { return fmt.Errorf("field mgfSha in RsaesOaepTestGroup: required") } if _, ok := raw["privateKey"]; raw != nil && !ok { return fmt.Errorf("field privateKey in RsaesOaepTestGroup: required") } if _, ok := raw["privateKeyPem"]; raw != nil && !ok { return fmt.Errorf("field privateKeyPem in RsaesOaepTestGroup: required") } if _, ok := raw["privateKeyPkcs8"]; raw != nil && !ok { return fmt.Errorf("field privateKeyPkcs8 in RsaesOaepTestGroup: required") } if _, ok := raw["sha"]; raw != nil && !ok { return fmt.Errorf("field sha in RsaesOaepTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in RsaesOaepTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in RsaesOaepTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in RsaesOaepTestGroup: required") } type Plain RsaesOaepTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = RsaesOaepTestGroup(plain) return nil } type RsaesOaepTestVector struct { // A brief description of the test case Comment string `json:"comment"` // An encryption of msg Ct string `json:"ct"` // A list of flags Flags []string `json:"flags"` // The label used for the encryption Label string `json:"label"` // The encrypted message Msg string `json:"msg"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *RsaesOaepTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in RsaesOaepTestVector: required") } if _, ok := raw["ct"]; raw != nil && !ok { return fmt.Errorf("field ct in RsaesOaepTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in RsaesOaepTestVector: required") } if _, ok := raw["label"]; raw != nil && !ok { return fmt.Errorf("field label in RsaesOaepTestVector: required") } if _, ok := raw["msg"]; raw != nil && !ok { return fmt.Errorf("field msg in RsaesOaepTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in RsaesOaepTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in RsaesOaepTestVector: required") } type Plain RsaesOaepTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = RsaesOaepTestVector(plain) return nil } type RsaesPkcs1DecryptSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema RsaesPkcs1DecryptSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []RsaesPkcs1TestGroup `json:"testGroups"` } type RsaesPkcs1DecryptSchemaV1JsonSchema string const RsaesPkcs1DecryptSchemaV1JsonSchemaRsaesPkcs1DecryptSchemaV1Json RsaesPkcs1DecryptSchemaV1JsonSchema = "rsaes_pkcs1_decrypt_schema_v1.json" var enumValues_RsaesPkcs1DecryptSchemaV1JsonSchema = []interface{}{ "rsaes_pkcs1_decrypt_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *RsaesPkcs1DecryptSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_RsaesPkcs1DecryptSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_RsaesPkcs1DecryptSchemaV1JsonSchema, v) } *j = RsaesPkcs1DecryptSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *RsaesPkcs1DecryptSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in RsaesPkcs1DecryptSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in RsaesPkcs1DecryptSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in RsaesPkcs1DecryptSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in RsaesPkcs1DecryptSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in RsaesPkcs1DecryptSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in RsaesPkcs1DecryptSchemaV1Json: required") } type Plain RsaesPkcs1DecryptSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = RsaesPkcs1DecryptSchemaV1Json(plain) return nil } type RsaesPkcs1TestGroup struct { // The size of the key in bits KeySize int `json:"keySize"` // PrivateKey corresponds to the JSON schema field "privateKey". PrivateKey PrivateKey `json:"privateKey"` // JWK encoded private key PrivateKeyJwk *JsonWebKey `json:"privateKeyJwk,omitempty"` // Pem encoded private key PrivateKeyPem string `json:"privateKeyPem"` // Pkcs 8 encoded private key. PrivateKeyPkcs8 string `json:"privateKeyPkcs8"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []RsaesPkcs1TestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type RsaesPkcs1TestGroupType `json:"type"` } type RsaesPkcs1TestGroupType string const RsaesPkcs1TestGroupTypeRsaesPkcs1Decrypt RsaesPkcs1TestGroupType = "RsaesPkcs1Decrypt" var enumValues_RsaesPkcs1TestGroupType = []interface{}{ "RsaesPkcs1Decrypt", } // UnmarshalJSON implements json.Unmarshaler. func (j *RsaesPkcs1TestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_RsaesPkcs1TestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_RsaesPkcs1TestGroupType, v) } *j = RsaesPkcs1TestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *RsaesPkcs1TestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["keySize"]; raw != nil && !ok { return fmt.Errorf("field keySize in RsaesPkcs1TestGroup: required") } if _, ok := raw["privateKey"]; raw != nil && !ok { return fmt.Errorf("field privateKey in RsaesPkcs1TestGroup: required") } if _, ok := raw["privateKeyPem"]; raw != nil && !ok { return fmt.Errorf("field privateKeyPem in RsaesPkcs1TestGroup: required") } if _, ok := raw["privateKeyPkcs8"]; raw != nil && !ok { return fmt.Errorf("field privateKeyPkcs8 in RsaesPkcs1TestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in RsaesPkcs1TestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in RsaesPkcs1TestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in RsaesPkcs1TestGroup: required") } type Plain RsaesPkcs1TestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = RsaesPkcs1TestGroup(plain) return nil } type RsaesPkcs1TestVector struct { // A brief description of the test case Comment string `json:"comment"` // An encryption of msg Ct string `json:"ct"` // A list of flags Flags []string `json:"flags"` // The encrypted message Msg string `json:"msg"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *RsaesPkcs1TestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in RsaesPkcs1TestVector: required") } if _, ok := raw["ct"]; raw != nil && !ok { return fmt.Errorf("field ct in RsaesPkcs1TestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in RsaesPkcs1TestVector: required") } if _, ok := raw["msg"]; raw != nil && !ok { return fmt.Errorf("field msg in RsaesPkcs1TestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in RsaesPkcs1TestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in RsaesPkcs1TestVector: required") } type Plain RsaesPkcs1TestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = RsaesPkcs1TestVector(plain) return nil } type RsassaPkcs1GenTestGroup struct { // DER encoding of the sequence [n, e] KeyAsn string `json:"keyAsn"` // DER encoding of the public key KeyDer string `json:"keyDer"` // [Optional] Private key in JWK format KeyJwk *JsonWebKey `json:"keyJwk,omitempty"` // Pem encoded public key KeyPem string `json:"keyPem"` // the size of the modulus in bits KeySize int `json:"keySize"` // PrivateKey corresponds to the JSON schema field "privateKey". PrivateKey PrivateKey `json:"privateKey"` // [Optional] Private key in JWK format PrivateKeyJwk *JsonWebKey `json:"privateKeyJwk,omitempty"` // Pem encoded private key PrivateKeyPem string `json:"privateKeyPem"` // DER encoding of the PKCS8 private key PrivateKeyPkcs8 string `json:"privateKeyPkcs8"` // the hash function used for the message Sha string `json:"sha"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []SignatureTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type RsassaPkcs1GenTestGroupType `json:"type"` } type RsassaPkcs1GenTestGroupType string const RsassaPkcs1GenTestGroupTypeRsassaPkcs1Generate RsassaPkcs1GenTestGroupType = "RsassaPkcs1Generate" var enumValues_RsassaPkcs1GenTestGroupType = []interface{}{ "RsassaPkcs1Generate", } // UnmarshalJSON implements json.Unmarshaler. func (j *RsassaPkcs1GenTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_RsassaPkcs1GenTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_RsassaPkcs1GenTestGroupType, v) } *j = RsassaPkcs1GenTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *RsassaPkcs1GenTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["keyAsn"]; raw != nil && !ok { return fmt.Errorf("field keyAsn in RsassaPkcs1GenTestGroup: required") } if _, ok := raw["keyDer"]; raw != nil && !ok { return fmt.Errorf("field keyDer in RsassaPkcs1GenTestGroup: required") } if _, ok := raw["keyPem"]; raw != nil && !ok { return fmt.Errorf("field keyPem in RsassaPkcs1GenTestGroup: required") } if _, ok := raw["keySize"]; raw != nil && !ok { return fmt.Errorf("field keySize in RsassaPkcs1GenTestGroup: required") } if _, ok := raw["privateKey"]; raw != nil && !ok { return fmt.Errorf("field privateKey in RsassaPkcs1GenTestGroup: required") } if _, ok := raw["privateKeyPem"]; raw != nil && !ok { return fmt.Errorf("field privateKeyPem in RsassaPkcs1GenTestGroup: required") } if _, ok := raw["privateKeyPkcs8"]; raw != nil && !ok { return fmt.Errorf("field privateKeyPkcs8 in RsassaPkcs1GenTestGroup: required") } if _, ok := raw["sha"]; raw != nil && !ok { return fmt.Errorf("field sha in RsassaPkcs1GenTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in RsassaPkcs1GenTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in RsassaPkcs1GenTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in RsassaPkcs1GenTestGroup: required") } type Plain RsassaPkcs1GenTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = RsassaPkcs1GenTestGroup(plain) return nil } type RsassaPkcs1GenerateSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema RsassaPkcs1GenerateSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []RsassaPkcs1GenTestGroup `json:"testGroups"` } type RsassaPkcs1GenerateSchemaV1JsonSchema string const RsassaPkcs1GenerateSchemaV1JsonSchemaRsassaPkcs1GenerateSchemaV1Json RsassaPkcs1GenerateSchemaV1JsonSchema = "rsassa_pkcs1_generate_schema_v1.json" var enumValues_RsassaPkcs1GenerateSchemaV1JsonSchema = []interface{}{ "rsassa_pkcs1_generate_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *RsassaPkcs1GenerateSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_RsassaPkcs1GenerateSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_RsassaPkcs1GenerateSchemaV1JsonSchema, v) } *j = RsassaPkcs1GenerateSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *RsassaPkcs1GenerateSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in RsassaPkcs1GenerateSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in RsassaPkcs1GenerateSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in RsassaPkcs1GenerateSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in RsassaPkcs1GenerateSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in RsassaPkcs1GenerateSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in RsassaPkcs1GenerateSchemaV1Json: required") } type Plain RsassaPkcs1GenerateSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = RsassaPkcs1GenerateSchemaV1Json(plain) return nil } type RsassaPkcs1TestGroup struct { // KeyJwk corresponds to the JSON schema field "keyJwk". KeyJwk *JsonWebKey `json:"keyJwk,omitempty"` // the size of the modulus in bits KeySize int `json:"keySize"` // PublicKey corresponds to the JSON schema field "publicKey". PublicKey RsassaPkcs1TestGroupPublicKey `json:"publicKey"` // ASN encoding of the sequence [n, e] PublicKeyAsn string `json:"publicKeyAsn"` // ASN encoding of the public key PublicKeyDer string `json:"publicKeyDer"` // Pem encoded public key PublicKeyPem string `json:"publicKeyPem"` // the hash function used for the message Sha string `json:"sha"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []SignatureTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type RsassaPkcs1TestGroupType `json:"type"` } type RsassaPkcs1TestGroupPublicKey struct { // The modulus of the key Modulus string `json:"modulus"` // The public exponent PublicExponent string `json:"publicExponent"` } // UnmarshalJSON implements json.Unmarshaler. func (j *RsassaPkcs1TestGroupPublicKey) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["modulus"]; raw != nil && !ok { return fmt.Errorf("field modulus in RsassaPkcs1TestGroupPublicKey: required") } if _, ok := raw["publicExponent"]; raw != nil && !ok { return fmt.Errorf("field publicExponent in RsassaPkcs1TestGroupPublicKey: required") } type Plain RsassaPkcs1TestGroupPublicKey var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = RsassaPkcs1TestGroupPublicKey(plain) return nil } type RsassaPkcs1TestGroupType string const RsassaPkcs1TestGroupTypeRsassaPkcs1Verify RsassaPkcs1TestGroupType = "RsassaPkcs1Verify" var enumValues_RsassaPkcs1TestGroupType = []interface{}{ "RsassaPkcs1Verify", } // UnmarshalJSON implements json.Unmarshaler. func (j *RsassaPkcs1TestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_RsassaPkcs1TestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_RsassaPkcs1TestGroupType, v) } *j = RsassaPkcs1TestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *RsassaPkcs1TestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["keySize"]; raw != nil && !ok { return fmt.Errorf("field keySize in RsassaPkcs1TestGroup: required") } if _, ok := raw["publicKey"]; raw != nil && !ok { return fmt.Errorf("field publicKey in RsassaPkcs1TestGroup: required") } if _, ok := raw["publicKeyAsn"]; raw != nil && !ok { return fmt.Errorf("field publicKeyAsn in RsassaPkcs1TestGroup: required") } if _, ok := raw["publicKeyDer"]; raw != nil && !ok { return fmt.Errorf("field publicKeyDer in RsassaPkcs1TestGroup: required") } if _, ok := raw["publicKeyPem"]; raw != nil && !ok { return fmt.Errorf("field publicKeyPem in RsassaPkcs1TestGroup: required") } if _, ok := raw["sha"]; raw != nil && !ok { return fmt.Errorf("field sha in RsassaPkcs1TestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in RsassaPkcs1TestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in RsassaPkcs1TestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in RsassaPkcs1TestGroup: required") } type Plain RsassaPkcs1TestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = RsassaPkcs1TestGroup(plain) return nil } type RsassaPkcs1VerifySchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema RsassaPkcs1VerifySchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []RsassaPkcs1TestGroup `json:"testGroups"` } type RsassaPkcs1VerifySchemaV1JsonSchema string const RsassaPkcs1VerifySchemaV1JsonSchemaRsassaPkcs1VerifySchemaV1Json RsassaPkcs1VerifySchemaV1JsonSchema = "rsassa_pkcs1_verify_schema_v1.json" var enumValues_RsassaPkcs1VerifySchemaV1JsonSchema = []interface{}{ "rsassa_pkcs1_verify_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *RsassaPkcs1VerifySchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_RsassaPkcs1VerifySchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_RsassaPkcs1VerifySchemaV1JsonSchema, v) } *j = RsassaPkcs1VerifySchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *RsassaPkcs1VerifySchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in RsassaPkcs1VerifySchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in RsassaPkcs1VerifySchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in RsassaPkcs1VerifySchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in RsassaPkcs1VerifySchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in RsassaPkcs1VerifySchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in RsassaPkcs1VerifySchemaV1Json: required") } type Plain RsassaPkcs1VerifySchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = RsassaPkcs1VerifySchemaV1Json(plain) return nil } type RsassaPssTestGroup struct { // the size of the modulus in bits KeySize int `json:"keySize"` // the message generating function (e.g. MGF1) Mgf string `json:"mgf"` // The hash function used for the message generating function. MgfSha string `json:"mgfSha"` // PublicKey corresponds to the JSON schema field "publicKey". PublicKey RsassaPssTestGroupPublicKey `json:"publicKey"` // ASN encoding of the sequence [n, e] PublicKeyAsn string `json:"publicKeyAsn"` // ASN encoding of the public key PublicKeyDer string `json:"publicKeyDer"` // PublicKeyJwk corresponds to the JSON schema field "publicKeyJwk". PublicKeyJwk *JsonWebKey `json:"publicKeyJwk,omitempty"` // Pem encoded public key PublicKeyPem string `json:"publicKeyPem"` // The salt length SLen int `json:"sLen"` // The hash function for hashing the message. Sha string `json:"sha"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []RsassaPssTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type RsassaPssTestGroupType `json:"type"` } type RsassaPssTestGroupPublicKey struct { // The modulus of the key Modulus string `json:"modulus"` // The public exponent PublicExponent string `json:"publicExponent"` } // UnmarshalJSON implements json.Unmarshaler. func (j *RsassaPssTestGroupPublicKey) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["modulus"]; raw != nil && !ok { return fmt.Errorf("field modulus in RsassaPssTestGroupPublicKey: required") } if _, ok := raw["publicExponent"]; raw != nil && !ok { return fmt.Errorf("field publicExponent in RsassaPssTestGroupPublicKey: required") } type Plain RsassaPssTestGroupPublicKey var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = RsassaPssTestGroupPublicKey(plain) return nil } type RsassaPssTestGroupType string const RsassaPssTestGroupTypeRsassaPssVerify RsassaPssTestGroupType = "RsassaPssVerify" var enumValues_RsassaPssTestGroupType = []interface{}{ "RsassaPssVerify", } // UnmarshalJSON implements json.Unmarshaler. func (j *RsassaPssTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_RsassaPssTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_RsassaPssTestGroupType, v) } *j = RsassaPssTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *RsassaPssTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["keySize"]; raw != nil && !ok { return fmt.Errorf("field keySize in RsassaPssTestGroup: required") } if _, ok := raw["mgf"]; raw != nil && !ok { return fmt.Errorf("field mgf in RsassaPssTestGroup: required") } if _, ok := raw["mgfSha"]; raw != nil && !ok { return fmt.Errorf("field mgfSha in RsassaPssTestGroup: required") } if _, ok := raw["publicKey"]; raw != nil && !ok { return fmt.Errorf("field publicKey in RsassaPssTestGroup: required") } if _, ok := raw["publicKeyAsn"]; raw != nil && !ok { return fmt.Errorf("field publicKeyAsn in RsassaPssTestGroup: required") } if _, ok := raw["publicKeyDer"]; raw != nil && !ok { return fmt.Errorf("field publicKeyDer in RsassaPssTestGroup: required") } if _, ok := raw["publicKeyPem"]; raw != nil && !ok { return fmt.Errorf("field publicKeyPem in RsassaPssTestGroup: required") } if _, ok := raw["sLen"]; raw != nil && !ok { return fmt.Errorf("field sLen in RsassaPssTestGroup: required") } if _, ok := raw["sha"]; raw != nil && !ok { return fmt.Errorf("field sha in RsassaPssTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in RsassaPssTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in RsassaPssTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in RsassaPssTestGroup: required") } type Plain RsassaPssTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = RsassaPssTestGroup(plain) return nil } type RsassaPssTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // The message to sign Msg string `json:"msg"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // a signature for msg Sig string `json:"sig"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *RsassaPssTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in RsassaPssTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in RsassaPssTestVector: required") } if _, ok := raw["msg"]; raw != nil && !ok { return fmt.Errorf("field msg in RsassaPssTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in RsassaPssTestVector: required") } if _, ok := raw["sig"]; raw != nil && !ok { return fmt.Errorf("field sig in RsassaPssTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in RsassaPssTestVector: required") } type Plain RsassaPssTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = RsassaPssTestVector(plain) return nil } type RsassaPssVerifySchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema RsassaPssVerifySchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []RsassaPssTestGroup `json:"testGroups"` } type RsassaPssVerifySchemaV1JsonSchema string const RsassaPssVerifySchemaV1JsonSchemaRsassaPssVerifySchemaV1Json RsassaPssVerifySchemaV1JsonSchema = "rsassa_pss_verify_schema_v1.json" var enumValues_RsassaPssVerifySchemaV1JsonSchema = []interface{}{ "rsassa_pss_verify_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *RsassaPssVerifySchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_RsassaPssVerifySchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_RsassaPssVerifySchemaV1JsonSchema, v) } *j = RsassaPssVerifySchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *RsassaPssVerifySchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in RsassaPssVerifySchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in RsassaPssVerifySchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in RsassaPssVerifySchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in RsassaPssVerifySchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in RsassaPssVerifySchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in RsassaPssVerifySchemaV1Json: required") } type Plain RsassaPssVerifySchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = RsassaPssVerifySchemaV1Json(plain) return nil } type SignatureTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // The message to sign Msg string `json:"msg"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // A signature for msg Sig string `json:"sig"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *SignatureTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in SignatureTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in SignatureTestVector: required") } if _, ok := raw["msg"]; raw != nil && !ok { return fmt.Errorf("field msg in SignatureTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in SignatureTestVector: required") } if _, ok := raw["sig"]; raw != nil && !ok { return fmt.Errorf("field sig in SignatureTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in SignatureTestVector: required") } type Plain SignatureTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = SignatureTestVector(plain) return nil } type Source struct { // Name corresponds to the JSON schema field "name". Name string `json:"name"` // Version corresponds to the JSON schema field "version". Version string `json:"version"` } // UnmarshalJSON implements json.Unmarshaler. func (j *Source) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in Source: required") } if _, ok := raw["version"]; raw != nil && !ok { return fmt.Errorf("field version in Source: required") } type Plain Source var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } if utf8.RuneCountInString(string(plain.Name)) < 1 { return fmt.Errorf("field %s length: must be >= %d", "name", 1) } if utf8.RuneCountInString(string(plain.Version)) < 1 { return fmt.Errorf("field %s length: must be >= %d", "version", 1) } *j = Source(plain) return nil } type XdhAsnCompSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema XdhAsnCompSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []XdhAsnTestGroup `json:"testGroups"` } type XdhAsnCompSchemaV1JsonSchema string const XdhAsnCompSchemaV1JsonSchemaXdhAsnCompSchemaV1Json XdhAsnCompSchemaV1JsonSchema = "xdh_asn_comp_schema_v1.json" var enumValues_XdhAsnCompSchemaV1JsonSchema = []interface{}{ "xdh_asn_comp_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhAsnCompSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_XdhAsnCompSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_XdhAsnCompSchemaV1JsonSchema, v) } *j = XdhAsnCompSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhAsnCompSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in XdhAsnCompSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in XdhAsnCompSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in XdhAsnCompSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in XdhAsnCompSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in XdhAsnCompSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in XdhAsnCompSchemaV1Json: required") } type Plain XdhAsnCompSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = XdhAsnCompSchemaV1Json(plain) return nil } type XdhAsnTestGroup struct { // the name of the curve Curve string `json:"curve"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []XdhAsnTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type XdhAsnTestGroupType `json:"type"` } type XdhAsnTestGroupType string const XdhAsnTestGroupTypeXdhAsnComp XdhAsnTestGroupType = "XdhAsnComp" var enumValues_XdhAsnTestGroupType = []interface{}{ "XdhAsnComp", } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhAsnTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_XdhAsnTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_XdhAsnTestGroupType, v) } *j = XdhAsnTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhAsnTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["curve"]; raw != nil && !ok { return fmt.Errorf("field curve in XdhAsnTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in XdhAsnTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in XdhAsnTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in XdhAsnTestGroup: required") } type Plain XdhAsnTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = XdhAsnTestGroup(plain) return nil } type XdhAsnTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // PKCS #8 encoded private key Private string `json:"private"` // X.509 encoded the public key Public string `json:"public"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // the shared secret Shared string `json:"shared"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhAsnTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in XdhAsnTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in XdhAsnTestVector: required") } if _, ok := raw["private"]; raw != nil && !ok { return fmt.Errorf("field private in XdhAsnTestVector: required") } if _, ok := raw["public"]; raw != nil && !ok { return fmt.Errorf("field public in XdhAsnTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in XdhAsnTestVector: required") } if _, ok := raw["shared"]; raw != nil && !ok { return fmt.Errorf("field shared in XdhAsnTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in XdhAsnTestVector: required") } type Plain XdhAsnTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = XdhAsnTestVector(plain) return nil } type XdhCompSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema XdhCompSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []XdhTestGroup `json:"testGroups"` } type XdhCompSchemaV1JsonSchema string const XdhCompSchemaV1JsonSchemaXdhCompSchemaV1Json XdhCompSchemaV1JsonSchema = "xdh_comp_schema_v1.json" var enumValues_XdhCompSchemaV1JsonSchema = []interface{}{ "xdh_comp_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhCompSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_XdhCompSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_XdhCompSchemaV1JsonSchema, v) } *j = XdhCompSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhCompSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in XdhCompSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in XdhCompSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in XdhCompSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in XdhCompSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in XdhCompSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in XdhCompSchemaV1Json: required") } type Plain XdhCompSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = XdhCompSchemaV1Json(plain) return nil } type XdhJwkCompSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema XdhJwkCompSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []XdhJwkTestGroup `json:"testGroups"` } type XdhJwkCompSchemaV1JsonSchema string const XdhJwkCompSchemaV1JsonSchemaXdhJwkCompSchemaV1Json XdhJwkCompSchemaV1JsonSchema = "xdh_jwk_comp_schema_v1.json" var enumValues_XdhJwkCompSchemaV1JsonSchema = []interface{}{ "xdh_jwk_comp_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhJwkCompSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_XdhJwkCompSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_XdhJwkCompSchemaV1JsonSchema, v) } *j = XdhJwkCompSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhJwkCompSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in XdhJwkCompSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in XdhJwkCompSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in XdhJwkCompSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in XdhJwkCompSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in XdhJwkCompSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in XdhJwkCompSchemaV1Json: required") } type Plain XdhJwkCompSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = XdhJwkCompSchemaV1Json(plain) return nil } type XdhJwkTestGroup struct { // the name of the curve Curve string `json:"curve"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []XdhJwkTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type XdhJwkTestGroupType `json:"type"` } type XdhJwkTestGroupType string const XdhJwkTestGroupTypeXdhJwkComp XdhJwkTestGroupType = "XdhJwkComp" var enumValues_XdhJwkTestGroupType = []interface{}{ "XdhJwkComp", } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhJwkTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_XdhJwkTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_XdhJwkTestGroupType, v) } *j = XdhJwkTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhJwkTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["curve"]; raw != nil && !ok { return fmt.Errorf("field curve in XdhJwkTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in XdhJwkTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in XdhJwkTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in XdhJwkTestGroup: required") } type Plain XdhJwkTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = XdhJwkTestGroup(plain) return nil } type XdhJwkTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // the private key in jwk format Private JsonWebKey `json:"private"` // the public key in jwk format Public JsonWebKey `json:"public"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // the shared secret Shared string `json:"shared"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhJwkTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in XdhJwkTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in XdhJwkTestVector: required") } if _, ok := raw["private"]; raw != nil && !ok { return fmt.Errorf("field private in XdhJwkTestVector: required") } if _, ok := raw["public"]; raw != nil && !ok { return fmt.Errorf("field public in XdhJwkTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in XdhJwkTestVector: required") } if _, ok := raw["shared"]; raw != nil && !ok { return fmt.Errorf("field shared in XdhJwkTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in XdhJwkTestVector: required") } type Plain XdhJwkTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = XdhJwkTestVector(plain) return nil } type XdhPemCompSchemaV1Json struct { // the primitive tested in the test file Algorithm string `json:"algorithm"` // DEPRECATED: prefer "source" property in test group GeneratorVersion *string `json:"generatorVersion,omitempty"` // additional documentation Header []string `json:"header"` // Notes corresponds to the JSON schema field "notes". Notes Notes `json:"notes"` // the number of test vectors in this test NumberOfTests int `json:"numberOfTests"` // Schema corresponds to the JSON schema field "schema". Schema XdhPemCompSchemaV1JsonSchema `json:"schema"` // TestGroups corresponds to the JSON schema field "testGroups". TestGroups []XdhPemTestGroup `json:"testGroups"` } type XdhPemCompSchemaV1JsonSchema string const XdhPemCompSchemaV1JsonSchemaXdhPemCompSchemaV1Json XdhPemCompSchemaV1JsonSchema = "xdh_pem_comp_schema_v1.json" var enumValues_XdhPemCompSchemaV1JsonSchema = []interface{}{ "xdh_pem_comp_schema_v1.json", } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhPemCompSchemaV1JsonSchema) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_XdhPemCompSchemaV1JsonSchema { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_XdhPemCompSchemaV1JsonSchema, v) } *j = XdhPemCompSchemaV1JsonSchema(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhPemCompSchemaV1Json) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["algorithm"]; raw != nil && !ok { return fmt.Errorf("field algorithm in XdhPemCompSchemaV1Json: required") } if _, ok := raw["header"]; raw != nil && !ok { return fmt.Errorf("field header in XdhPemCompSchemaV1Json: required") } if _, ok := raw["notes"]; raw != nil && !ok { return fmt.Errorf("field notes in XdhPemCompSchemaV1Json: required") } if _, ok := raw["numberOfTests"]; raw != nil && !ok { return fmt.Errorf("field numberOfTests in XdhPemCompSchemaV1Json: required") } if _, ok := raw["schema"]; raw != nil && !ok { return fmt.Errorf("field schema in XdhPemCompSchemaV1Json: required") } if _, ok := raw["testGroups"]; raw != nil && !ok { return fmt.Errorf("field testGroups in XdhPemCompSchemaV1Json: required") } type Plain XdhPemCompSchemaV1Json var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = XdhPemCompSchemaV1Json(plain) return nil } type XdhPemTestGroup struct { // the name of the curve Curve string `json:"curve"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []XdhPemTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type XdhPemTestGroupType `json:"type"` } type XdhPemTestGroupType string const XdhPemTestGroupTypeXdhPemComp XdhPemTestGroupType = "XdhPemComp" var enumValues_XdhPemTestGroupType = []interface{}{ "XdhPemComp", } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhPemTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_XdhPemTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_XdhPemTestGroupType, v) } *j = XdhPemTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhPemTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["curve"]; raw != nil && !ok { return fmt.Errorf("field curve in XdhPemTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in XdhPemTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in XdhPemTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in XdhPemTestGroup: required") } type Plain XdhPemTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = XdhPemTestGroup(plain) return nil } type XdhPemTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // a raw private key Private string `json:"private"` // PEM encoded public key Public string `json:"public"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // the shared secret Shared string `json:"shared"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhPemTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in XdhPemTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in XdhPemTestVector: required") } if _, ok := raw["private"]; raw != nil && !ok { return fmt.Errorf("field private in XdhPemTestVector: required") } if _, ok := raw["public"]; raw != nil && !ok { return fmt.Errorf("field public in XdhPemTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in XdhPemTestVector: required") } if _, ok := raw["shared"]; raw != nil && !ok { return fmt.Errorf("field shared in XdhPemTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in XdhPemTestVector: required") } type Plain XdhPemTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = XdhPemTestVector(plain) return nil } type XdhTestGroup struct { // the name of the curve Curve string `json:"curve"` // Source corresponds to the JSON schema field "source". Source Source `json:"source"` // Tests corresponds to the JSON schema field "tests". Tests []XdhTestVector `json:"tests"` // Type corresponds to the JSON schema field "type". Type XdhTestGroupType `json:"type"` } type XdhTestGroupType string const XdhTestGroupTypeXdhComp XdhTestGroupType = "XdhComp" var enumValues_XdhTestGroupType = []interface{}{ "XdhComp", } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhTestGroupType) UnmarshalJSON(value []byte) error { var v string if err := json.Unmarshal(value, &v); err != nil { return err } var ok bool for _, expected := range enumValues_XdhTestGroupType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_XdhTestGroupType, v) } *j = XdhTestGroupType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhTestGroup) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["curve"]; raw != nil && !ok { return fmt.Errorf("field curve in XdhTestGroup: required") } if _, ok := raw["source"]; raw != nil && !ok { return fmt.Errorf("field source in XdhTestGroup: required") } if _, ok := raw["tests"]; raw != nil && !ok { return fmt.Errorf("field tests in XdhTestGroup: required") } if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in XdhTestGroup: required") } type Plain XdhTestGroup var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = XdhTestGroup(plain) return nil } type XdhTestVector struct { // A brief description of the test case Comment string `json:"comment"` // A list of flags Flags []string `json:"flags"` // the raw bytes of private key Private string `json:"private"` // the raw bytes of the public key Public string `json:"public"` // Result corresponds to the JSON schema field "result". Result Result `json:"result"` // the shared secret Shared string `json:"shared"` // Identifier of the test case TcId int `json:"tcId"` } // UnmarshalJSON implements json.Unmarshaler. func (j *XdhTestVector) UnmarshalJSON(value []byte) error { var raw map[string]interface{} if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["comment"]; raw != nil && !ok { return fmt.Errorf("field comment in XdhTestVector: required") } if _, ok := raw["flags"]; raw != nil && !ok { return fmt.Errorf("field flags in XdhTestVector: required") } if _, ok := raw["private"]; raw != nil && !ok { return fmt.Errorf("field private in XdhTestVector: required") } if _, ok := raw["public"]; raw != nil && !ok { return fmt.Errorf("field public in XdhTestVector: required") } if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in XdhTestVector: required") } if _, ok := raw["shared"]; raw != nil && !ok { return fmt.Errorf("field shared in XdhTestVector: required") } if _, ok := raw["tcId"]; raw != nil && !ok { return fmt.Errorf("field tcId in XdhTestVector: required") } type Plain XdhTestVector var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } *j = XdhTestVector(plain) return nil }