aboutsummaryrefslogtreecommitdiff
path: root/crypto.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-03-19 15:49:04 +0100
committerDimitri Sokolyuk <demon@dim13.org>2016-03-19 15:49:04 +0100
commitbe4ffabba4162b944cedce6a98ed5fc6071f51aa (patch)
tree32d550d5a42d8dd0f44922be9155649f906cb82c /crypto.go
parent20071a9bc4aa4731ff91426d0164492397582021 (diff)
Expicit key sizes
Diffstat (limited to 'crypto.go')
-rw-r--r--crypto.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/crypto.go b/crypto.go
index d7b3b10..e3be942 100644
--- a/crypto.go
+++ b/crypto.go
@@ -88,11 +88,16 @@ func NewKey(size int) (crypto.PrivateKey, error) {
return ecdsa.GenerateKey(elliptic.P384(), rand.Reader)
case 521:
return ecdsa.GenerateKey(elliptic.P521(), rand.Reader)
+ case 1024:
+ return rsa.GenerateKey(rand.Reader, 1024)
+ case 1536:
+ return rsa.GenerateKey(rand.Reader, 1536)
+ case 2048:
+ return rsa.GenerateKey(rand.Reader, 2048)
+ case 4096:
+ return rsa.GenerateKey(rand.Reader, 4096)
default:
- if size < 1024 {
- return nil, ErrKeySize
- }
- return rsa.GenerateKey(rand.Reader, size)
+ return nil, ErrKeySize
}
}