Documentation
¶
Index ¶
- Variables
- func DecodeLicenseSignature(signature []byte) (*OuterSignature, *InnerSignature, *AppSigningKeys, error)
- func Decrypt(in []byte) (result []byte, err error)
- func Encrypt(in []byte) []byte
- func FindGlobalPublicKeyRSA(keyID string) (string, error)
- func InitFromSecret(clientset kubernetes.Interface, namespace string) error
- func InitFromString(data string) error
- func NewAESCipher() error
- func ResetCustomPublicKeyRSA()
- func SetCustomPublicKeyRSA(publicKeyPEM string) error
- func ToString() string
- func VerifySignatureRSA(message, signature []byte, publicKeyPEM string, hashAlgo crypto.Hash) error
- func VerifySignatureWithKeyRSA(message, signature []byte, publicKey *rsa.PublicKey, hashAlgo crypto.Hash) error
- type AppSigningKeys
- type InnerSignature
- type KeySignature
- type NoDecryptionKeysErr
- type OuterSignature
Constants ¶
This section is empty.
Variables ¶
var PublicKeysRSA = map[string][]byte{ "1d3f7f6b50714fe7b895554dd65773b0": []byte(`-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAugyKfZV2gIDaY1Rzkjoo fbNywGa04sGQIAqYwifMay2e2xzqRwswTRHQnr9SIWypkN86Cfn6QzOB8kkjERC1 DPNdsiKdjBFdcLaxxdyHgrXLgfdzhh6We+Lpq19JT5LCK3PXleZgt/a0aRBpIc1l xKs57d8MTWUTVh3W3WYi6LbqAPScdmSiG7A145HhKXmmtZFEv4puE5dKmS5lkV2d VU789XWrNFk74FKKHVwYMdppqAabB6cRBmU8YFiVEULOn+d1FtKRbO/vv/fbA9nX PUG/1PgEQHogP+3cC4J7b7s9+kBmtHkpSq9x+OUu/5B+nT21dooS6adfQiI8iB/+ NQIDAQAB -----END PUBLIC KEY-----`), "bdee56560cfb43c9b28bf98eacafa646": []byte(`-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwdSHE8v64QH/yELBoPBl GanhS3AD5vMAaqLLFnftwjmDKrxWwqNB9w1GVJWb5gVLvt/UlE/k+HVr5HFdomVI TMvnvxhD0UvNyGFuUbXBMvQPPW9joR48LcCBLZl+RZTqR5HRhsIbujiExRDnteaq mU1jG/oVlQkRoyOYrObTeoD0BdcZAr2PdGvgvJvpZduZtrKvjvsSJEBYExoPtko+ 8AqhMBAI+qX1/SMix21qpmYSYLNeqN2Pplna0p2MK8yyaHY8KSqTF90ZJF1+P0ZF MLt6S8/6PIX9WD+vFqmDpW1GCkB+p2OfxsYiAIX1ej98Ck3hoPQnOuiFIovV8aFQ bQIDAQAB -----END PUBLIC KEY-----`), "de2c275656d04b1bb0f15cf70f0ea2a2": []byte(`-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2hHg1HER6NYlsqBs+B+B txibtctT6YB5kxgE1sz7UmVnlcLs+Olc4OZJwD4vLsEU60SVW0HRoTfaGaradv0R GUIxlFRSOnzjZEMkm/YKL3sdPQigi2m9O0P5tC9LQvzk49dFg5HJxiLODCgWwJ9g q3pGs8OaAc0dop/tqUE7WqQfHLWJdTPP5pVDLDWybfAO4OmgVmx+oVXdCfMVlOzu num6SOF+eBuERXQGbEfnd6eSRVokWhfMCfXNPTYtq14DaK9tvX4uzHsub+Asn6UN OBIAESJntpZfdDDrNqbfOQYql2rqx1lJtU7lVFbTQTkKhj4teInEGO6FvLzy0UE9 swIDAQAB -----END PUBLIC KEY-----`), }
Default public keys for signature verification
Functions ¶
func DecodeLicenseSignature ¶
func DecodeLicenseSignature(signature []byte) (*OuterSignature, *InnerSignature, *AppSigningKeys, error)
DecodeLicenseSignature decodes a base64-encoded signature and returns the outer and inner signature structures along with the parsed app signing keys
func FindGlobalPublicKeyRSA ¶
FindGlobalPublicKeyRSA finds the global public key for the given key ID
func InitFromSecret ¶
func InitFromSecret(clientset kubernetes.Interface, namespace string) error
InitFromSecret reads the encryption key from kubernetes and adds it to the list of decryptionCiphers, and sets this key to be used for encryption.
func InitFromString ¶
InitFromString parses the encryption key from the provided string and adds it to the list of decryptionCiphers
func NewAESCipher ¶
func NewAESCipher() error
NewAESCipher creates a new AES cipher to be used for encryption and decryption. If one already exists, it is used instead.
func ResetCustomPublicKeyRSA ¶
func ResetCustomPublicKeyRSA()
ResetCustomPublicKey clears any custom public key and reverts to default public keys
func SetCustomPublicKeyRSA ¶
SetCustomPublicKey sets a custom public key to use instead of the default public keys
func ToString ¶
func ToString() string
ToString returns a string representation of the global encryption key
func VerifySignatureRSA ¶
VerifySignature verifies an RSA-PSS signature using the specified hash algorithm
Types ¶
type AppSigningKeys ¶
AppSigningKeys contains the public key used to verify license and entitlement signatures
type InnerSignature ¶
type InnerSignature struct {
LicenseSignature []byte `json:"licenseSignature,omitempty"`
V2LicenseSignature []byte `json:"v2LicenseSignature,omitempty"`
PublicKey string `json:"publicKey"`
KeySignature []byte `json:"keySignature,omitempty"`
V2KeySignature []byte `json:"v2KeySignature,omitempty"`
}
InnerSignature represents the inner layer of the license signature
type KeySignature ¶
type KeySignature struct {
Signature []byte `json:"signature"`
GlobalKeyID string `json:"globalKeyId"`
}
KeySignature represents a key signature structure
type NoDecryptionKeysErr ¶
type NoDecryptionKeysErr struct{}
func (NoDecryptionKeysErr) Error ¶
func (e NoDecryptionKeysErr) Error() string
type OuterSignature ¶
type OuterSignature struct {
LicenseData []byte `json:"licenseData"`
InnerSignature []byte `json:"innerSignature"`
}
OuterSignature represents the outer layer of the license signature