aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-12-25 21:30:16 +0000
committerlloyd <[email protected]>2013-12-25 21:30:16 +0000
commite72c0d999d0784ce2610e4bed471f4483da72943 (patch)
treeacdd9de1f8223152a863ce767ddd08c7a615abba
parentd5ebaa5e921a70cde791ac4d41035c3881712087 (diff)
Same for EC groups
-rw-r--r--src/libstate/policy.cpp267
-rw-r--r--src/pubkey/dl_group/dl_group.cpp10
-rw-r--r--src/pubkey/dl_group/dl_group.h7
-rw-r--r--src/pubkey/dl_group/named.cpp (renamed from src/pubkey/dl_group/dl_groups.cpp)2
-rw-r--r--src/pubkey/ec_group/ec_group.cpp5
-rw-r--r--src/pubkey/ec_group/ec_group.h5
6 files changed, 18 insertions, 278 deletions
diff --git a/src/libstate/policy.cpp b/src/libstate/policy.cpp
index 1d02f0e35..1208cbcbc 100644
--- a/src/libstate/policy.cpp
+++ b/src/libstate/policy.cpp
@@ -297,272 +297,6 @@ void set_default_aliases(Library_State& config)
config.add_alias("GOST-34.11", "GOST-R-34.11-94");
}
-/*
-* Set the built-in discrete log groups
-*/
-void set_default_dl_groups(Library_State& config)
- {
- config.set("ec", "secp112r1",
- "-----BEGIN EC PARAMETERS-----"
- "MHQCAQEwGgYHKoZIzj0BAQIPANt8Kr9i415mgHa+rSCLMCAEDtt8Kr9i415mgHa+"
- "rSCIBA5lnvi6BDkW7t6JEXArIgQdBAlIcjmZWl7na1X5wvCYqJzlr4ckwKI+Dg/3"
- "dQACDwDbfCq/YuNedijfrGVhxQIBAQ=="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "secp112r2",
- "-----BEGIN EC PARAMETERS-----"
- "MHMCAQEwGgYHKoZIzj0BAQIPANt8Kr9i415mgHa+rSCLMCAEDmEnwkwF84oKqvZc"
- "DvAsBA5R3vGBXbXtdPzDTIXXCQQdBEujCrXokrThZJ3QkoZDrc1G9YguN0fe826V"
- "bpcCDjbfCq/YuNdZfKEFINBLAgEB"
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "secp128r1",
- "-----BEGIN EC PARAMETERS-----"
- "MIGAAgEBMBwGByqGSM49AQECEQD////9////////////////MCQEEP////3/////"
- "//////////wEEOh1ecEQefQ92CSZPCzuXtMEIQQWH/dSi4mbLQwoYHylLFuGz1rI"
- "OVuv6xPALaKS3e16gwIRAP////4AAAAAdaMNG5A4oRUCAQE="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "secp128r2",
- "-----BEGIN EC PARAMETERS-----"
- "MH8CAQEwHAYHKoZIzj0BAQIRAP////3///////////////8wJAQQ1gMZmNGzu/6/"
- "Wcybv/mu4QQQXu78o4DQKRncLGVYu22KXQQhBHtqpdheVymD5vsyp83rwUAntpFq"
- "iU067nEG/oBfw0tEAhA/////f////74AJHIGE7WjAgEE"
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "secp160k1",
- "-----BEGIN EC PARAMETERS-----"
- "MIGYAgEBMCAGByqGSM49AQECFQD////////////////////+//+sczAsBBQAAAAA"
- "AAAAAAAAAAAAAAAAAAAAAAQUAAAAAAAAAAAAAAAAAAAAAAAAAAcEKQQ7TDgs43qh"
- "kqQBnnYwNvT13U1+u5OM+TUxj9zta8KChlMXM8PwPE/uAhUBAAAAAAAAAAAAAbj6"
- "Ft+rmsoWtrMCAQE="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "secp160r1",
- "-----BEGIN EC PARAMETERS-----"
- "MIGYAgEBMCAGByqGSM49AQECFQD/////////////////////f////zAsBBT/////"
- "////////////////f////AQUHJe+/FS9eotlrPifgdTUrcVl+kUEKQRKlrVojvVz"
- "KEZkaYlow4u5E8v8giOmKFUxaJR9WdzJEgQjUTd6xfsyAhUBAAAAAAAAAAAAAfTI"
- "+Seu08p1IlcCAQE="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "secp160r2",
- "-----BEGIN EC PARAMETERS-----"
- "MIGYAgEBMCAGByqGSM49AQECFQD////////////////////+//+sczAsBBT/////"
- "///////////////+//+scAQUtOE00/tZ64urVydJBGZNWvUDiLoEKQRS3LA0KToR"
- "fh9P8Rsw9xmdMUTObf6v/vLjMfKW4HH6DfmYLP6n1D8uAhUBAAAAAAAAAAAAADUe"
- "54aoGPOhoWsCAQE="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "secp192k1",
- "-----BEGIN EC PARAMETERS-----"
- "MIGwAgEBMCQGByqGSM49AQECGQD//////////////////////////v//7jcwNAQY"
- "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
- "AAMEMQTbT/EOwFfpriawfQKAt/Q0HaXRsergbH2bLy9tnFYop4RBY9AVvoY0QIKq"
- "iNleL50CGQD///////////////4m8vwXD2lGanTe/Y0CAQE="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "secp192r1",
- "-----BEGIN EC PARAMETERS-----"
- "MIGwAgEBMCQGByqGSM49AQECGQD////////////////////+//////////8wNAQY"
- "/////////////////////v/////////8BBhkIQUZ5ZyA5w+n6atyJDBJ/rje7MFG"
- "ubEEMQQYjagOsDCQ9ny/IOtDoYgA9P8K/YL/EBIHGSuV/8jaeGMQEe1rJM3Vc/l3"
- "oR55SBECGQD///////////////+Z3vg2FGvJsbTSKDECAQE="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "secp224k1",
- "-----BEGIN EC PARAMETERS-----"
- "MIHIAgEBMCgGByqGSM49AQECHQD///////////////////////////////7//+Vt"
- "MDwEHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEHAAAAAAAAAAAAAAAAAAA"
- "AAAAAAAAAAAAAAAAAAUEOQShRVszTfCZ3zD8KKFppGfp5HB1qQ9+ZQ62t6Rcfgif"
- "7X+6NEKCyvvW9+MZ98CwvVniykvbVW1hpQIdAQAAAAAAAAAAAAAAAAAB3OjS7GGE"
- "yvCpcXafsfcCAQE="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "secp224r1",
- "-----BEGIN EC PARAMETERS-----"
- "MIHIAgEBMCgGByqGSM49AQECHQD/////////////////////AAAAAAAAAAAAAAAB"
- "MDwEHP////////////////////7///////////////4EHLQFCoUMBLOr9UEyVlBE"
- "sLfXv9i6Jws5QyNV/7QEOQS3Dgy9a7S/fzITkLlKA8HTVsIRIjQygNYRXB0hvTdj"
- "iLX3I/tMIt/mzUN1oFoHR2RE1YGZhQB+NAIdAP//////////////////FqLguPA+"
- "E90pRVxcKj0CAQE="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "secp256k1",
- "-----BEGIN EC PARAMETERS-----"
- "MIHgAgEBMCwGByqGSM49AQECIQD////////////////////////////////////+"
- "///8LzBEBCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQgAAAAAAAA"
- "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcEQQR5vmZ++dy7rFWgYpXOhwsHApv8"
- "2y3OKNlZ8oFbFvgXmEg62ncmo8RlXaT7/A4RCKj9F7RIpoVUGZxH0I/7ENS4AiEA"
- "/////////////////////rqu3OavSKA7v9JejNA2QUECAQE="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "secp256r1",
- "-----BEGIN EC PARAMETERS-----"
- "MIHgAgEBMCwGByqGSM49AQECIQD/////AAAAAQAAAAAAAAAAAAAAAP//////////"
- "/////zBEBCD/////AAAAAQAAAAAAAAAAAAAAAP///////////////AQgWsY12Ko6"
- "k+ez671VdpiGvGUdBrDMU7D2O848PifSYEsEQQRrF9Hy4SxCR/i85uVjpEDydwN9"
- "gS3rM6D0oTlF2JjClk/jQuL+Gn+bjufrSnwPnhYrzjNXazFezsu2QGg3v1H1AiEA"
- "/////wAAAAD//////////7zm+q2nF56E87nKwvxjJVECAQE="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "secp384r1",
- "-----BEGIN EC PARAMETERS-----"
- "MIIBQAIBATA8BgcqhkjOPQEBAjEA////////////////////////////////////"
- "//////7/////AAAAAAAAAAD/////MGQEMP//////////////////////////////"
- "///////////+/////wAAAAAAAAAA/////AQwszEvp+I+5+SYjgVr4/gtGRgdnG7+"
- "gUESAxQIj1ATh1rGVjmNii7RnSqFyO3T7CrvBGEEqofKIr6LBTeOscce8yCtdG4d"
- "O2KLp5uYWfdB4IJUKjhVAvJdv1UpbDpUXjhydgq3NhfeSpYmLG9dnpi/kpLcKfj0"
- "Hb0omhR86doxE7XwuMAKYLHOHX6BnXpDHXyQ6g5fAjEA////////////////////"
- "////////////x2NNgfQ3Ld9YGg2ySLCneuzsGWrMxSlzAgEB"
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "secp521r1",
- "-----BEGIN EC PARAMETERS-----"
- "MIIBrAIBATBNBgcqhkjOPQEBAkIB////////////////////////////////////"
- "//////////////////////////////////////////////////8wgYgEQgH/////"
- "////////////////////////////////////////////////////////////////"
- "/////////////////ARCAFGVPrlhjhyaH5KaIaC2hUDuotpyW5mzFfO4tImRjvEJ"
- "4VYZOVHsfpN7FlLAvTuxvwc1c9+IPSw08e9FH9RrUD8ABIGFBADGhY4GtwQE6c2e"
- "PstmI5W0QpxkgTkFP7Uh+CivYGtNPbqhS1537+dZKP4dwSei/6jeM0izwYVqQpv5"
- "fn4xwuW9ZgEYOSlqeJo7wARcil+0LH0b2Zj1RElXm0RoF6+9Fyc+ZiyX7nKZXvQm"
- "QMVQuQE/rQdhNTxwhqJywkCIvpR2n9FmUAJCAf//////////////////////////"
- "////////////////+lGGh4O/L5Zrf8wBSPcJpdA7tcm4iZxHrrtvtx6ROGQJAgEB"
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "1.3.6.1.4.1.8301.3.1.2.9.0.38",
- "-----BEGIN EC PARAMETERS-----"
- "MIIBrAIBATBNBgcqhkjOPQEBAkIB////////////////////////////////////"
- "//////////////////////////////////////////////////8wgYgEQgH/////"
- "////////////////////////////////////////////////////////////////"
- "/////////////////ARCAFGVPrlhjhyaH5KaIaC2hUDuotpyW5mzFfO4tImRjvEJ"
- "4VYZOVHsfpN7FlLAvTuxvwc1c9+IPSw08e9FH9RrUD8ABIGFBADGhY4GtwQE6c2e"
- "PstmI5W0QpxkgTkFP7Uh+CivYGtNPbqhS1537+dZKP4dwSei/6jeM0izwYVqQpv5"
- "fn4xwuW9ZgEYOSlqeJo7wARcil+0LH0b2Zj1RElXm0RoF6+9Fyc+ZiyX7nKZXvQm"
- "QMVQuQE/rQdhNTxwhqJywkCIvpR2n9FmUAJCAf//////////////////////////"
- "////////////////+lGGh4O/L5Zrf8wBSPcJpdA7tcm4iZxHrrtvtx6ROGQJAgEB"
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "brainpool160r1",
- "-----BEGIN EC PARAMETERS-----"
- "MIGYAgEBMCAGByqGSM49AQECFQDpXkpfc3BZ3GDfx62Vs9gTlRViDzAsBBQ0Dnvi"
- "ooDrdOK+YbradF2X6PfDAAQUHliahZVCNBITT6otveyVyNhnXlgEKQS+1a8W6j9q"
- "T2KTjEYx61r3vbzbwxZny0d6Go7DOPlHQWacl2MW2mMhAhUA6V5KX3NwWdxg31mR"
- "1FApQJ5g/AkCAQE="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "brainpool192r1",
- "-----BEGIN EC PARAMETERS-----"
- "MIGwAgEBMCQGByqGSM49AQECGQDDAvQdkyo2zaejRjCT0Y23j85HbeGoYpcwNAQY"
- "apEXQHax4OGcOcAx/oaFwcrgQOXGmijvBBhGmijvfCjMo9xyHQRPRJa8yn70FG+/"
- "JckEMQTAoGR+qrakh1OwM8VssPCQCi9cSFM3X9YUtpCGar1buItfSCjBSQAC5nc/"
- "ovopm48CGQDDAvQdkyo2zaejRi+enpFrW+jxAprErMECAQE="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "brainpool224r1",
- "-----BEGIN EC PARAMETERS-----"
- "MIHIAgEBMCgGByqGSM49AQECHQDXwTSqJkNmhioYMCV10deHsJ8HV5faifV+yMD/"
- "MDwEHGil5iypzmwcKZgDpsFTC1FOGCrYsAQqWcrSn0MEHCWA9jzP5EE4hwcTsakj"
- "aeM+ITXSZtuzcjhsQAsEOQQNkCmtLH5c9DQII7KofcaMnkzjF0webv3uEsB9WKpW"
- "93LAcm8kxrieTs2sJDVLnpnKo/bTdhQCzQIdANfBNKomQ2aGKhgwJXXQ+5jRFrxL"
- "bd68o6Wnk58CAQE="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "brainpool256r1",
- "-----BEGIN EC PARAMETERS-----"
- "MIHgAgEBMCwGByqGSM49AQECIQCp+1fboe6pvD5mCpCdg41ybjv2I9UmICggE0gd"
- "H25TdzBEBCB9Wgl1/CwwV+72dTBBev/n+4BVwSbcXGzpSktE8zC12QQgJtxcbOlK"
- "S0TzMLXZu9d8v5WEFilc9+HOa8zcGP+MB7YEQQSL0q65y35XyyxLSC/8gbevud4n"
- "4eO9I8I6RFO9ms4yYlR++DXD2sT9l/hGGhRhHcnCd0UTLe2OVFwdVMcvBGmXAiEA"
- "qftX26Huqbw+ZgqQnYONcYw5eqO1Yab3kB4OgpdIVqcCAQE="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "brainpool320r1",
- "-----BEGIN EC PARAMETERS-----"
- "MIIBEAIBATA0BgcqhkjOPQEBAikA015HIDa8T7fhPHhe0gHgZfmPz6b29A3vT5K5"
- "7HiT7Cj81BKx8bMuJzBUBCg+4wtWj7qw+IPM69RtPzu4oqc1E/XredpmGQ6whf+p"
- "9JLzdal9hg60BChSCIOUnf28QtOtGYZAaIpv4T9BNJVUtJrMMdzNiEU5gW9etKyP"
- "sfGmBFEEQ71+mvtT2LhSibzEjuW/5vIBN9EKCH6254ceKhClmccQr40NOeIGERT9"
- "0FVF7BzIq0CTJH93J14HQ//tEXGC6qnHeHeqrGrH01JF0WkujuECKQDTXkcgNrxP"
- "t+E8eF7SAeBl+Y/PpbaPEqMtSC7H7oZY6YaRVVtExZMRAgEB"
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "brainpool384r1",
- "-----BEGIN EC PARAMETERS-----"
- "MIIBQAIBATA8BgcqhkjOPQEBAjEAjLkegqM4bSgPXW9+UOZB3xUvcQntVFa0ErHa"
- "GX+3ESOs06cpkB0acYdHABMxB+xTMGQEMHvDgsY9jBUMPHIICs4Fr6DCvqKOT7In"
- "hxORZe+6kfkPiqWBSlA61OsEqMfdIs4oJgQwBKjH3SLOKCaLObVUFvBEfC+3feEH"
- "3NKmLogOpT7rYtV8tDkCldvJlDq3hpb6UEwRBGEEHRxk8GjPRf+ipjqBt8E/a4hH"
- "o+d+8U/j23/K/gy9EOjoJuA0NtZGqu+HsuJH1K8eir4ddSD5wqRcseuOlc/VUmK3"
- "Cyn+7Fhk4ZwFT/mRKSgORkYhd5GBEUKCA0EmPFMVAjEAjLkegqM4bSgPXW9+UOZB"
- "3xUvcQntVFazHxZubKwEJafPOrava3/DEDuIMgLpBGVlAgEB"
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "brainpool512r1",
- "-----BEGIN EC PARAMETERS-----"
- "MIIBogIBATBMBgcqhkjOPQEBAkEAqt2duNvpxIs/1OauM8n8B8swjbOzydIO1mOc"
- "ynAzCHF9TZsAm8ZoQq7NoSrmo4DmKIH/Ly2CxoUoqmBWWDpI8zCBhARAeDCjMYtg"
- "O4niMnFFrCNMxZTL3Y09+RYQqDRByuqYY7wt7V1aqCU6oQou8cmLmsi1fxEXpyvy"
- "x7nnwaxNd/yUygRAPfkWEKg0QcrqmGO8Le1dWqglOqEKLvHJi5rItX8RF6cr8se5"
- "58GsTXf8lMrcCD5nmEBQt1665d0oCb1jgBb3IwSBgQSBruS92C7ZZFohMi6cTGqT"
- "he2fcLXZFsG0O2Lu9NAJjv87H3ji0NSNUNFoe5O5fV98bVBHQGpeaIs1Igm8ufgi"
- "fd44XVZjMuzA6r+pz3gi/fIJ9wAkpXsaoADFW4gfgRGy3N5JSl9IXlvKS9iKJ2Ou"
- "0corL6jwVAZ4zR4POtgIkgJBAKrdnbjb6cSLP9TmrjPJ/AfLMI2zs8nSDtZjnMpw"
- "MwhwVT5cQUypJhlBhmEZf6wQRx2x04EIXdrdtYeWgpypAGkCAQE="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "x962_p192v2",
- "-----BEGIN EC PARAMETERS-----"
- "MIGwAgEBMCQGByqGSM49AQECGQD////////////////////+//////////8wNAQY"
- "/////////////////////v/////////8BBjMItbfuVxrJeScDWNkpOWYDDk6ohZo"
- "2VMEMQTuorrn4Ul4QvLed2nP6cmJwHKtaW9IA0pldNEdabbsemcruCoIPfLysIR9"
- "6XCy3hUCGQD///////////////5fsack3IBBhkjY3TECAQE="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "x962_p192v3",
- "-----BEGIN EC PARAMETERS-----"
- "MIGwAgEBMCQGByqGSM49AQECGQD////////////////////+//////////8wNAQY"
- "/////////////////////v/////////8BBgiEj3COVoFyqdCPa7MyUdgp9RiJWvV"
- "aRYEMQR9KXeBAMZaHaF4NxZYjc4ri0rujiKPGJY4qQ8iY3M3M0tJ3LZqbcj5l4rK"
- "dkipQ7ACGQD///////////////96YtAxyD9ClPZA7BMCAQE="
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "x962_p239v1",
- "-----BEGIN EC PARAMETERS-----"
- "MIHSAgEBMCkGByqGSM49AQECHn///////////////3///////4AAAAAAAH//////"
- "/zBABB5///////////////9///////+AAAAAAAB///////wEHmsBbDvc8YlB0NZU"
- "khR1ynGp2y+yfR03eWGFwpQsCgQ9BA/6ljzcqIFszDO4ZCvt+QXD01hXPT8n+707"
- "PLmqr33r6OTpCl2ubkBUylMLoEZUs2gYziJrOfzLewLxrgIef///////////////"
- "f///nl6an12QcfvRUiaIkJ0LAgEB"
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "x962_p239v2",
- "-----BEGIN EC PARAMETERS-----"
- "MIHSAgEBMCkGByqGSM49AQECHn///////////////3///////4AAAAAAAH//////"
- "/zBABB5///////////////9///////+AAAAAAAB///////wEHmF/q2gyV2y7/tUN"
- "mfAknD/uWLlLoAOMeuhMjIMvLAQ9BDivCdmHJ3BRIMkhu16eJilqPNzy81dXoOr9"
- "h7gw51sBJeTb6g7HIG2g/AHZsIEyn7VV3m70YCN9/4vkugIef///////////////"
- "gAAAz6foWUN31BTAOCG8WCBjAgEB"
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "x962_p239v3",
- "-----BEGIN EC PARAMETERS-----"
- "MIHSAgEBMCkGByqGSM49AQECHn///////////////3///////4AAAAAAAH//////"
- "/zBABB5///////////////9///////+AAAAAAAB///////wEHiVXBfoqMGZUsfTL"
- "A9anUKMMJQEC1JiHF9m6FattPgQ9BGdoro4Yu5LPzwBclJqixtlIU9DmYLv4VLHJ"
- "UF/pWhYH5omPOQwGvB1VK60ibztvz+SLboGEma8Y4+1s8wIef///////////////"
- "f///l13rQbOmBXw8QyFGUmVRAgEB"
- "-----END EC PARAMETERS-----");
-
- config.set("ec", "gost_256A",
- "-----BEGIN EC PARAMETERS-----"
- "MIHgAgEBMCwGByqGSM49AQECIQD/////////////////////////////////////"
- "///9lzBEBCD////////////////////////////////////////9lAQgAAAAAAAA"
- "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKYEQQQAAAAAAAAAAAAAAAAAAAAAAAAA"
- "AAAAAAAAAAAAAAAAAY2R5HHgmJzaJ99QWkU/K3Y1KU8t3yPjsSKsyZyenx4UAiEA"
- "/////////////////////2xhEHCZWtEARYQbCbdhuJMCAQE="
- "-----END EC PARAMETERS-----");
- }
}
/*
@@ -572,7 +306,6 @@ void Library_State::load_default_config()
{
set_default_aliases(*this);
set_default_oids(*this);
- set_default_dl_groups(*this);
}
}
diff --git a/src/pubkey/dl_group/dl_group.cpp b/src/pubkey/dl_group/dl_group.cpp
index 96009c58a..6fd1beeaa 100644
--- a/src/pubkey/dl_group/dl_group.cpp
+++ b/src/pubkey/dl_group/dl_group.cpp
@@ -28,14 +28,14 @@ DL_Group::DL_Group()
/*
* DL_Group Constructor
*/
-DL_Group::DL_Group(const std::string& type)
+DL_Group::DL_Group(const std::string& name)
{
- const char* grp = lookup(type);
+ const char* pem = PEM_for_named_group(name);
- if(!grp)
- throw Invalid_Argument("DL_Group: Unknown group " + type);
+ if(!pem)
+ throw Invalid_Argument("DL_Group: Unknown group " + name);
- PEM_decode(grp);
+ PEM_decode(pem);
}
/*
diff --git a/src/pubkey/dl_group/dl_group.h b/src/pubkey/dl_group/dl_group.h
index dafcdc180..e219bdcbd 100644
--- a/src/pubkey/dl_group/dl_group.h
+++ b/src/pubkey/dl_group/dl_group.h
@@ -21,8 +21,6 @@ class BOTAN_DLL DL_Group
{
public:
- static const char* lookup(const std::string& name);
-
/**
* Get the prime p.
* @return prime p
@@ -153,6 +151,11 @@ class BOTAN_DLL DL_Group
* @param g the base g
*/
DL_Group(const BigInt& p, const BigInt& q, const BigInt& g);
+
+ /**
+ * Return PEM representation of named DL group
+ */
+ static const char* PEM_for_named_group(const std::string& name);
private:
static BigInt make_dsa_generator(const BigInt&, const BigInt&);
diff --git a/src/pubkey/dl_group/dl_groups.cpp b/src/pubkey/dl_group/named.cpp
index 308d31cf3..df44f026b 100644
--- a/src/pubkey/dl_group/dl_groups.cpp
+++ b/src/pubkey/dl_group/named.cpp
@@ -9,7 +9,7 @@
namespace Botan {
-const char* DL_Group::lookup(const std::string& name)
+const char* DL_Group::PEM_for_named_group(const std::string& name)
{
if(name == "modp/ietf/1024")
return
diff --git a/src/pubkey/ec_group/ec_group.cpp b/src/pubkey/ec_group/ec_group.cpp
index 6da5ef08f..9143543e4 100644
--- a/src/pubkey/ec_group/ec_group.cpp
+++ b/src/pubkey/ec_group/ec_group.cpp
@@ -18,10 +18,9 @@ namespace Botan {
EC_Group::EC_Group(const OID& domain_oid)
{
- std::string pem =
- global_state().get("ec", OIDS::lookup(domain_oid));
+ const char* pem = PEM_for_named_group(OIDS::lookup(domain_oid));
- if(pem == "")
+ if(!pem)
throw Lookup_Error("No ECC domain data for " + domain_oid.as_string());
*this = EC_Group(pem);
diff --git a/src/pubkey/ec_group/ec_group.h b/src/pubkey/ec_group/ec_group.h
index 756c158dc..80859bd71 100644
--- a/src/pubkey/ec_group/ec_group.h
+++ b/src/pubkey/ec_group/ec_group.h
@@ -122,6 +122,11 @@ class BOTAN_DLL EC_Group
(get_cofactor() == other.get_cofactor()));
}
+ /**
+ * Return PEM representation of named EC group
+ */
+ static const char* PEM_for_named_group(const std::string& name);
+
private:
CurveGFp curve;
PointGFp base_point;