diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2023-10-28 08:26:20 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-28 08:26:20 -0400 |
| commit | 1b226e58af4058190ce0889aa54b5c489ede554f (patch) | |
| tree | fd30d0f54edf2642605f28a40af89e28392c658b /crypto | |
| parent | cdb317959ba9f4e12919b60b7ebd40f2afc1b345 (diff) | |
A bunch of linting and refactorings (#1893)
Diffstat (limited to 'crypto')
| -rw-r--r-- | crypto/ecdsa.go | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/crypto/ecdsa.go b/crypto/ecdsa.go index 6f377390..02212b20 100644 --- a/crypto/ecdsa.go +++ b/crypto/ecdsa.go @@ -10,15 +10,21 @@ import ( "fmt" ) -var ( - // Curves is a map of curve names to curves - Curves = map[string]elliptic.Curve{ - "P224": elliptic.P224(), - "P256": elliptic.P256(), - "P384": elliptic.P384(), - "P521": elliptic.P521(), +// Curves - +func Curves(c string) (elliptic.Curve, bool) { + switch c { + case "P224": + return elliptic.P224(), true + case "P256": + return elliptic.P256(), true + case "P384": + return elliptic.P384(), true + case "P521": + return elliptic.P521(), true + default: + return nil, false } -) +} // ECDSAGenerateKey - func ECDSAGenerateKey(curve elliptic.Curve) ([]byte, error) { |
