forked from spiffe/spire
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Force Rotation: local authority scaffolding and implements X.509 auth…
…ority endpoints (spiffe#4020) * Create local authority scaffolding, and implements X.509 local authority service Signed-off-by: Marcos Yacob <[email protected]> Signed-off-by: Neniel <[email protected]>
- Loading branch information
Showing
32 changed files
with
2,096 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package x509util_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/spiffe/spire/pkg/common/x509util" | ||
"github.com/spiffe/spire/test/testkey" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
var ( | ||
privateKey = testkey.MustEC256() | ||
) | ||
|
||
func TestSubjectKeyIDToString(t *testing.T) { | ||
t.Run("empty ski", func(t *testing.T) { | ||
str := x509util.SubjectKeyIDToString([]byte{}) | ||
require.Empty(t, str) | ||
}) | ||
|
||
t.Run("small byte", func(t *testing.T) { | ||
str := x509util.SubjectKeyIDToString([]byte("foo")) | ||
require.Equal(t, "666f6f", str) | ||
}) | ||
|
||
t.Run("no odd number", func(t *testing.T) { | ||
str := x509util.SubjectKeyIDToString([]byte{1}) | ||
require.Equal(t, "01", str) | ||
}) | ||
|
||
realSKI, err := x509util.GetSubjectKeyID(privateKey.Public()) | ||
require.NoError(t, err) | ||
|
||
t.Run("real parsed ski", func(t *testing.T) { | ||
str := x509util.SubjectKeyIDToString(realSKI) | ||
require.Equal(t, "42c702d94031c6bc849ec99fa361802a877bdade", str) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.