mirror of
https://github.com/storytold/irsa-manager.git
synced 2026-10-29 08:57:49 +00:00
JWK
This commit is contained in:
@@ -8,11 +8,11 @@ import (
|
||||
)
|
||||
|
||||
type KeyPair struct {
|
||||
PublicKey []byte
|
||||
PrivateKey []byte
|
||||
publicKey []byte
|
||||
privateKey []byte
|
||||
}
|
||||
|
||||
func createKeyPair() (*KeyPair, error) {
|
||||
func CreateKeyPair() (*KeyPair, error) {
|
||||
privateKey, err := rsa.GenerateKey(rand.Reader, 2048)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -38,3 +38,11 @@ func createKeyPair() (*KeyPair, error) {
|
||||
pubPemBytes := pem.EncodeToMemory(&pubPem)
|
||||
return &KeyPair{pubPemBytes, privPemBytes}, nil
|
||||
}
|
||||
|
||||
func (k *KeyPair) PublicKey() []byte {
|
||||
return k.publicKey
|
||||
}
|
||||
|
||||
func (k *KeyPair) PrivateKey() []byte {
|
||||
return k.privateKey
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user