encryption

package
v0.0.39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2023 License: MIT Imports: 13 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBase64KeyFingerprint

func GetBase64KeyFingerprint(key interface{}) string

func GetKeyBytes

func GetKeyBytes(key interface{}) []byte

func GetMD5KeyFingerprint

func GetMD5KeyFingerprint(key interface{}) [16]byte

func GetSHA1KeyFingerprint

func GetSHA1KeyFingerprint(key interface{}) [20]byte

func GetSHA2KeyFingerprint

func GetSHA2KeyFingerprint(key interface{}) [32]byte

Types

type ECDSAHelper

type ECDSAHelper struct{}

func (ECDSAHelper) Decode

func (h ECDSAHelper) Decode(pemEncoded string, pemEncodedPub string) (*ecdsa.PrivateKey, *ecdsa.PublicKey)

func (ECDSAHelper) DecodePrivateKeyFromBase64

func (h ECDSAHelper) DecodePrivateKeyFromBase64(bas64Encoded string) *ecdsa.PrivateKey

func (ECDSAHelper) DecodePrivateKeyFromBase64Pem

func (h ECDSAHelper) DecodePrivateKeyFromBase64Pem(bas64Encoded string) *ecdsa.PrivateKey

func (ECDSAHelper) DecodePrivateKeyFromPem

func (h ECDSAHelper) DecodePrivateKeyFromPem(pemEncoded string) *ecdsa.PrivateKey

func (ECDSAHelper) DecodePublicKeyFromBase64

func (h ECDSAHelper) DecodePublicKeyFromBase64(bas64Encoded string) *ecdsa.PublicKey

func (ECDSAHelper) DecodePublicKeyFromBase64Pem

func (h ECDSAHelper) DecodePublicKeyFromBase64Pem(bas64Encoded string) *ecdsa.PublicKey

func (ECDSAHelper) DecodePublicKeyFromPem

func (h ECDSAHelper) DecodePublicKeyFromPem(pemEncoded string) *ecdsa.PublicKey

func (ECDSAHelper) Encode

func (h ECDSAHelper) Encode(privateKey *ecdsa.PrivateKey, publicKey *ecdsa.PublicKey) (string, string)

func (ECDSAHelper) GenerateKeys

func (h ECDSAHelper) GenerateKeys(size EncryptionKeySize) (*ecdsa.PrivateKey, *ecdsa.PublicKey)

func (ECDSAHelper) GeneratePrivateKey

func (h ECDSAHelper) GeneratePrivateKey(size EncryptionKeySize) *ecdsa.PrivateKey

type EncryptionKey

type EncryptionKey int64
const (
	HS256 EncryptionKey = iota
	HS384
	HS512
	RS256
	RS384
	RS512
	ES256
	ES384
	ES512
	PS256
	PS384
	PS512
)

func (EncryptionKey) FromString

func (j EncryptionKey) FromString(keyType string) EncryptionKey

func (EncryptionKey) GetFamily

func (j EncryptionKey) GetFamily() EncryptionKeyType

func (EncryptionKey) MarshalJSON

func (s EncryptionKey) MarshalJSON() ([]byte, error)

func (EncryptionKey) String

func (j EncryptionKey) String() string

func (*EncryptionKey) UnmarshalJSON

func (s *EncryptionKey) UnmarshalJSON(b []byte) error

type EncryptionKeySize

type EncryptionKeySize int64
const (
	Bit256  EncryptionKeySize = 256
	Bit384  EncryptionKeySize = 384
	Bit512  EncryptionKeySize = 512
	Bit1024 EncryptionKeySize = 1024
	Bit2048 EncryptionKeySize = 2048
	Bit4096 EncryptionKeySize = 4096
)

func (EncryptionKeySize) FromString

func (s EncryptionKeySize) FromString(key string) EncryptionKeySize

func (EncryptionKeySize) MarshalJSON

func (s EncryptionKeySize) MarshalJSON() ([]byte, error)

func (EncryptionKeySize) String

func (s EncryptionKeySize) String() string

func (*EncryptionKeySize) UnmarshalJSON

func (s *EncryptionKeySize) UnmarshalJSON(b []byte) error

type EncryptionKeyType

type EncryptionKeyType int64
const (
	ECDSA EncryptionKeyType = iota
	HMAC
	RSA
)

func (EncryptionKeyType) FromString

func (j EncryptionKeyType) FromString(keyType string) EncryptionKeyType

func (EncryptionKeyType) MarshalJSON

func (s EncryptionKeyType) MarshalJSON() ([]byte, error)

func (EncryptionKeyType) String

func (j EncryptionKeyType) String() string

func (*EncryptionKeyType) UnmarshalJSON

func (s *EncryptionKeyType) UnmarshalJSON(b []byte) error

type RSAHelper

type RSAHelper struct{}

func (RSAHelper) Decode

func (h RSAHelper) Decode(pemEncoded string, pemEncodedPub string) (*rsa.PrivateKey, *rsa.PublicKey)

func (RSAHelper) DecodePrivateKeyFromBase64

func (h RSAHelper) DecodePrivateKeyFromBase64(bas64Encoded string) *rsa.PrivateKey

func (RSAHelper) DecodePrivateKeyFromBase64Pem

func (h RSAHelper) DecodePrivateKeyFromBase64Pem(bas64Encoded string) *rsa.PrivateKey

func (RSAHelper) DecodePrivateKeyFromPem

func (h RSAHelper) DecodePrivateKeyFromPem(pemEncoded string) *rsa.PrivateKey

func (RSAHelper) DecodePublicKeyFromBase64

func (h RSAHelper) DecodePublicKeyFromBase64(bas64Encoded string) *rsa.PublicKey

func (RSAHelper) DecodePublicKeyFromBase64Pem

func (h RSAHelper) DecodePublicKeyFromBase64Pem(bas64Encoded string) *rsa.PublicKey

func (RSAHelper) DecodePublicKeyFromPem

func (h RSAHelper) DecodePublicKeyFromPem(pemEncoded string) *rsa.PublicKey

func (RSAHelper) Encode

func (h RSAHelper) Encode(privateKey *rsa.PrivateKey, publicKey *rsa.PublicKey) (string, string)

func (RSAHelper) GenerateKeys

func (h RSAHelper) GenerateKeys(size EncryptionKeySize) (*rsa.PrivateKey, *rsa.PublicKey)

func (RSAHelper) GeneratePrivateKey

func (h RSAHelper) GeneratePrivateKey(size EncryptionKeySize) *rsa.PrivateKey

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL