【调整】暗色主题样式

This commit is contained in:
cai
2025-12-12 17:39:52 +08:00
parent 13669666e4
commit d01b42139c
1199 changed files with 203816 additions and 4592 deletions

View File

@@ -0,0 +1,40 @@
package private_ca
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/rsa"
"fmt"
gm "github.com/tjfoc/gmsm/sm2"
)
func generatePrivateKey(keyType KeyType, keyBits int) (interface{}, error) {
switch keyType {
case KeyRSA:
if keyBits == 0 {
keyBits = 2048
}
return rsa.GenerateKey(rand.Reader, keyBits)
case KeyECDSA:
var c elliptic.Curve
switch keyBits {
case 224:
c = elliptic.P224()
case 256:
c = elliptic.P256()
case 384:
c = elliptic.P384()
case 521:
c = elliptic.P521()
default:
c = elliptic.P384()
}
return ecdsa.GenerateKey(c, rand.Reader)
case KeySM2:
return gm.GenerateKey(rand.Reader)
default:
return nil, fmt.Errorf("unsupported key type: %s", keyType)
}
}