Documentation ¶
Index ¶
- Constants
- Variables
- type Key
- type KeySet
- func (s *KeySet) Count() int
- func (s *KeySet) KeyById(kid string) (*Key, error)
- func (s *KeySet) KeyForEncryption(alg string) (*Key, error)
- func (s *KeySet) KeyForSigning(alg string) (*Key, error)
- func (s *KeySet) MarshalJSON() ([]byte, error)
- func (s *KeySet) ToPublic() *KeySet
- func (s *KeySet) UnmarshalJSON(bytes []byte) error
Constants ¶
const ( UseSig = "sig" UseEnc = "enc" )
Standard key use parameters.
Variables ¶
var (
ErrKeyNotFound = errors.New("json web key is not found")
)
Functions ¶
This section is empty.
Types ¶
type Key ¶
type Key jose.JSONWebKey
Key is an alias to jose.JSONWebKey to add more functions.
func GenerateEncryptionKey ¶
GenerateEncryptionKey generates an encryption Key with the given kid and algorithm.
func GenerateSignatureKey ¶
GenerateSignatureKey generates a signature Key with the given kid and algorithm.
func (*Key) IsPublicAsymmetric ¶
IsPublicAsymmetric returns true if the underlying asymmetric key only has the public portion. If called is not sure about the key's symmetry, check with IsSymmetric first.
func (*Key) IsSymmetric ¶
IsSymmetric returns true if the underlying key uses symmetric algorithms (i.e. HS256)
type KeySet ¶
type KeySet struct {
// contains filtered or unexported fields
}
func ReadKeySet ¶
ReadKeySet create new KeySet with data from the reader
func (*KeySet) KeyForEncryption ¶
KeyForEncryption find a key for encryption with the given algorithm. The returned key may be a private key, in which case, caller needs to convert to a public key before use. If multiple encryption keys with the same algorithm exists in the set, the last one based on the current time.
func (*KeySet) KeyForSigning ¶
KeyForSigning find a key for signing with the given algorithm. If multiple signing keys with the same algorithm exists in the set, the last one is picked.
func (*KeySet) MarshalJSON ¶
func (*KeySet) ToPublic ¶
ToPublic returns a new KeySet with only public asymmetric keys so that it is read to be shared.