mirror of
https://github.com/1f349/mjwt.git
synced 2024-12-22 07:24:05 +00:00
Update go mod sum
Fix up KeyStore
This commit is contained in:
parent
5e627ed024
commit
9a1029861c
3
go.sum
3
go.sum
@ -1,5 +1,4 @@
|
|||||||
github.com/1f349/rsa-helper v0.0.0-20240608023351-e4382c728b17 h1:cgJDS14TTM8hvg1qNhXFj3IfFEZ99IXR00D8gcwbY98=
|
github.com/1f349/rsa-helper v0.0.1 h1:Ec/MXHR2eIpLgIR69eqhCV2o8OOBs2JZNAkEhW7HQks=
|
||||||
github.com/1f349/rsa-helper v0.0.0-20240608023351-e4382c728b17/go.mod h1:VUQ++1tYYhYrXeOmVFkQ82BegR24HQEJHl5lHbjg7yg=
|
|
||||||
github.com/1f349/rsa-helper v0.0.1/go.mod h1:VUQ++1tYYhYrXeOmVFkQ82BegR24HQEJHl5lHbjg7yg=
|
github.com/1f349/rsa-helper v0.0.1/go.mod h1:VUQ++1tYYhYrXeOmVFkQ82BegR24HQEJHl5lHbjg7yg=
|
||||||
github.com/becheran/wildmatch-go v1.0.0 h1:mE3dGGkTmpKtT4Z+88t8RStG40yN9T+kFEGj2PZFSzA=
|
github.com/becheran/wildmatch-go v1.0.0 h1:mE3dGGkTmpKtT4Z+88t8RStG40yN9T+kFEGj2PZFSzA=
|
||||||
github.com/becheran/wildmatch-go v1.0.0/go.mod h1:gbMvj0NtVdJ15Mg/mH9uxk2R1QCistMyU7d9KFzroX4=
|
github.com/becheran/wildmatch-go v1.0.0/go.mod h1:gbMvj0NtVdJ15Mg/mH9uxk2R1QCistMyU7d9KFzroX4=
|
||||||
|
11
key_store.go
11
key_store.go
@ -50,7 +50,8 @@ func NewMJwtKeyStoreFromDirectory(directory, keyPrvExt, keyPubExt string) (KeySt
|
|||||||
if kID == "" {
|
if kID == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if path.Ext(entry.Name()) == "."+keyPrvExt {
|
pExt := path.Ext(entry.Name())
|
||||||
|
if pExt == "."+keyPrvExt {
|
||||||
// Load rsa private key with the file name as the kID (Up to the first .)
|
// Load rsa private key with the file name as the kID (Up to the first .)
|
||||||
key, err2 := rsaprivate.Read(path.Join(directory, entry.Name()))
|
key, err2 := rsaprivate.Read(path.Join(directory, entry.Name()))
|
||||||
if err2 == nil {
|
if err2 == nil {
|
||||||
@ -58,7 +59,7 @@ func NewMJwtKeyStoreFromDirectory(directory, keyPrvExt, keyPubExt string) (KeySt
|
|||||||
ks.storePub[kID] = &key.PublicKey
|
ks.storePub[kID] = &key.PublicKey
|
||||||
}
|
}
|
||||||
errs = append(errs, err2)
|
errs = append(errs, err2)
|
||||||
} else if path.Ext(entry.Name()) == "."+keyPubExt {
|
} else if pExt == "."+keyPubExt {
|
||||||
// Load rsa public key with the file name as the kID (Up to the first .)
|
// Load rsa public key with the file name as the kID (Up to the first .)
|
||||||
key, err2 := rsapublic.Read(path.Join(directory, entry.Name()))
|
key, err2 := rsapublic.Read(path.Join(directory, entry.Name()))
|
||||||
if err2 == nil {
|
if err2 == nil {
|
||||||
@ -71,8 +72,7 @@ func NewMJwtKeyStoreFromDirectory(directory, keyPrvExt, keyPubExt string) (KeySt
|
|||||||
errs = append(errs, err2)
|
errs = append(errs, err2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = errors.Join(errs...)
|
return ks, errors.Join(errs...)
|
||||||
return ks, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExportKeyStore saves all the keys stored in the specified KeyStore into a directory with the specified
|
// ExportKeyStore saves all the keys stored in the specified KeyStore into a directory with the specified
|
||||||
@ -102,8 +102,7 @@ func ExportKeyStore(ks KeyStore, directory, keyPrvExt, keyPubExt string) error {
|
|||||||
errs = append(errs, err2)
|
errs = append(errs, err2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = errors.Join(errs...)
|
return errors.Join(errs...)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetKey adds a new rsa.PrivateKey with the specified kID to the KeyStore.
|
// SetKey adds a new rsa.PrivateKey with the specified kID to the KeyStore.
|
||||||
|
Loading…
Reference in New Issue
Block a user