mirror of
https://github.com/storytold/irsa-manager.git
synced 2026-10-28 08:47:48 +00:00
JWK
This commit is contained in:
@@ -14,13 +14,13 @@ import (
|
||||
|
||||
func TestReadKey(t *testing.T) {
|
||||
t.Run("key pair check", func(t *testing.T) {
|
||||
keyPair, err := createKeyPair()
|
||||
keyPair, err := CreateKeyPair()
|
||||
assert.NoError(t, err)
|
||||
|
||||
message := []byte("test message")
|
||||
hashed := sha256.Sum256(message)
|
||||
|
||||
block, _ := pem.Decode(keyPair.PrivateKey)
|
||||
block, _ := pem.Decode(keyPair.PrivateKey())
|
||||
assert.NotNil(t, block, "failed to decode private key to PEM")
|
||||
|
||||
privateKey, err := x509.ParsePKCS1PrivateKey(block.Bytes)
|
||||
@@ -29,7 +29,7 @@ func TestReadKey(t *testing.T) {
|
||||
signature, err := rsa.SignPKCS1v15(rand.Reader, privateKey, crypto.SHA256, hashed[:])
|
||||
|
||||
assert.NoError(t, err, "failed to create signature")
|
||||
block, _ = pem.Decode(keyPair.PublicKey)
|
||||
block, _ = pem.Decode(keyPair.PublicKey())
|
||||
assert.NotNil(t, block, "failed to decode public key to PEM")
|
||||
|
||||
pubKey, err := x509.ParsePKIXPublicKey(block.Bytes)
|
||||
|
||||
Reference in New Issue
Block a user