diff options
author | Jack Lloyd <[email protected]> | 2017-06-29 11:02:22 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-06-29 11:02:22 -0400 |
commit | 1678ab06b69e8ec58a90b6c1f505b6080800f52a (patch) | |
tree | 55c7cede8d83f2406b4e8f734dead2ec8d71fdd6 /src | |
parent | 62c94693cb1cf5ddc5e8e43a787561e7d8351258 (diff) |
Add a check in EC_Group encoding for OID being set
Otherwise encoding would fail with an obtuse error message.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/pubkey/ec_group/ec_group.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/pubkey/ec_group/ec_group.cpp b/src/lib/pubkey/ec_group/ec_group.cpp index e8a9672ab..c8d464a22 100644 --- a/src/lib/pubkey/ec_group/ec_group.cpp +++ b/src/lib/pubkey/ec_group/ec_group.cpp @@ -118,7 +118,13 @@ EC_Group::DER_encode(EC_Group_Encoding form) const .get_contents_unlocked(); } else if(form == EC_DOMPAR_ENC_OID) + { + if(get_oid().empty()) + { + throw Encoding_Error("Cannot encode EC_Group as OID because OID not set"); + } return DER_Encoder().encode(OID(get_oid())).get_contents_unlocked(); + } else if(form == EC_DOMPAR_ENC_IMPLICITCA) return DER_Encoder().encode_null().get_contents_unlocked(); else |