Botan 3.6.1
Crypto and TLS for C&
Botan::PCurve::PrimeOrderCurveId Class Referencefinal

Identifier for a named prime order curve. More...

#include <pcurves_id.h>

Public Types

enum class  Code : uint8_t {
  secp192r1 , secp224r1 , secp256r1 , secp384r1 ,
  secp521r1 , secp256k1 , brainpool256r1 , brainpool384r1 ,
  brainpool512r1 , frp256v1 , sm2p256v1 , numsp512d1
}
 

Public Member Functions

Code code () const
 
 PrimeOrderCurveId (Code id)
 
std::string to_string () const
 Convert the ID to it's commonly used name (inverse of from_string)
 

Static Public Member Functions

static std::vector< PrimeOrderCurveIdall ()
 
static std::optional< PrimeOrderCurveIdfrom_string (std::string_view name)
 Map a string to a curve identifier.
 

Detailed Description

Identifier for a named prime order curve.

Definition at line 28 of file pcurves_id.h.

Member Enumeration Documentation

◆ Code

enum class Botan::PCurve::PrimeOrderCurveId::Code : uint8_t
strong
Enumerator
secp192r1 

secp192r1 aka P-192

secp224r1 

secp224r1 aka P-224

secp256r1 

secp256r1 aka P-256

secp384r1 

secp384r1 aka P-384

secp521r1 

secp521r1 aka P-521

secp256k1 

secp256k1

brainpool256r1 

brainpool256r1

brainpool384r1 
brainpool512r1 
frp256v1 
sm2p256v1 
numsp512d1 

Definition at line 30 of file pcurves_id.h.

30 : uint8_t {
31 /// secp192r1 aka P-192
33 /// secp224r1 aka P-224
35 /// secp256r1 aka P-256
37 /// secp384r1 aka P-384
39 /// secp521r1 aka P-521
41 /// secp256k1
43 /// brainpool256r1
50 };

Constructor & Destructor Documentation

◆ PrimeOrderCurveId()

Botan::PCurve::PrimeOrderCurveId::PrimeOrderCurveId ( Code id)
inline

Definition at line 65 of file pcurves_id.h.

65: m_code(id) {}

Member Function Documentation

◆ all()

std::vector< PrimeOrderCurveId > Botan::PCurve::PrimeOrderCurveId::all ( )
static

◆ code()

Code Botan::PCurve::PrimeOrderCurveId::code ( ) const
inline

Definition at line 54 of file pcurves_id.h.

54{ return m_code; }

Referenced by to_string().

◆ from_string()

std::optional< PrimeOrderCurveId > Botan::PCurve::PrimeOrderCurveId::from_string ( std::string_view name)
static

Map a string to a curve identifier.

Definition at line 180 of file pcurves.cpp.

180 {
181 if(name == "secp192r1") {
183 } else if(name == "secp224r1") {
185 } else if(name == "secp256r1") {
187 } else if(name == "secp384r1") {
189 } else if(name == "secp521r1") {
191 } else if(name == "secp256k1") {
193 } else if(name == "brainpool256r1") {
195 } else if(name == "brainpool384r1") {
197 } else if(name == "brainpool512r1") {
199 } else if(name == "frp256v1") {
201 } else if(name == "sm2p256v1") {
203 } else if(name == "numsp512d1") {
205 } else {
206 return {};
207 }
208}
std::string name

References brainpool256r1, brainpool384r1, brainpool512r1, frp256v1, name, numsp512d1, secp192r1, secp224r1, secp256k1, secp256r1, secp384r1, secp521r1, and sm2p256v1.

◆ to_string()

std::string Botan::PCurve::PrimeOrderCurveId::to_string ( ) const

Convert the ID to it's commonly used name (inverse of from_string)

Definition at line 148 of file pcurves.cpp.

148 {
149 switch(this->code()) {
151 return "secp192r1";
153 return "secp224r1";
155 return "secp256r1";
157 return "secp384r1";
159 return "secp521r1";
161 return "secp256k1";
163 return "brainpool256r1";
165 return "brainpool384r1";
167 return "brainpool512r1";
169 return "frp256v1";
171 return "sm2p256v1";
173 return "numsp512d1";
174 }
175
176 return "unknown";
177}

References brainpool256r1, brainpool384r1, brainpool512r1, code(), frp256v1, numsp512d1, secp192r1, secp224r1, secp256k1, secp256r1, secp384r1, secp521r1, and sm2p256v1.


The documentation for this class was generated from the following files: