Documentation ¶
Index ¶
- Variables
- func BuildHTTPClientWithTLSOptions(cli *http.Client, cfg config.TLSConfig) (*http.Client, error)
- func BuildHTTPClientWithTracerLogger(cli *http.Client, logger *logrus.Entry) (*http.Client, error)
- func CalculateECDSAKeySizes(keyMin int, KeyMax int) []int
- func CalculateRSAKeySizes(keyMin int, KeyMax int) []int
- func CertificateToPEM(c *x509.Certificate) string
- func ConfigureLogger(ctx context.Context, logger *logrus.Entry) *logrus.Entry
- func DecryptWithPrivateKey(ciphertext []byte, priv *rsa.PrivateKey) ([]byte, error)
- func EncryptWithPublicKey(msg []byte, pub *rsa.PublicKey) ([]byte, error)
- func GenerateCertificateRequest(subject models.Subject, key any) (*x509.CertificateRequest, error)
- func GenerateCertificateRequestWithExtensions(subject models.Subject, extensions []pkix.Extension, key any) (*x509.CertificateRequest, error)
- func GenerateECDSAKey(curve elliptic.Curve) (*ecdsa.PrivateKey, error)
- func GenerateRSAKey(bits int) (*rsa.PrivateKey, error)
- func GenerateSelfSignedCA(keyType x509.PublicKeyAlgorithm, expirationTime time.Duration, ...) (*x509.Certificate, any, error)
- func GenerateSelfSignedCertificate(key crypto.Signer, cn string) (*x509.Certificate, error)
- func GetMetadataToStruct(metadata map[string]any, keyToGet string, elem any) (bool, error)
- func InitContext() context.Context
- func KeyStrengthMetadataFromCertificate(cert *x509.Certificate) models.KeyStrengthMetadata
- func LoadSystemCACertPoolWithExtraCAsFromFiles(casToAdd []string) *x509.CertPool
- func LoadSytemCACertPool() *x509.CertPool
- func MergeMaps[E any](m1 *map[string]E, m2 *map[string]E) *map[string]E
- func ParseCertificate(cert string) (*x509.Certificate, error)
- func ParsePrivateKey(privKeyBytes []byte) (interface{}, error)
- func PkixNameToString(subject pkix.Name) string
- func PkixNameToSubject(pkixName pkix.Name) models.Subject
- func PrivateKeyToPEM(key any) (string, error)
- func ReadCertificateFromFile(filePath string) (*x509.Certificate, error)
- func ReadPrivateKeyFromFile(filePath string) (interface{}, error)
- func SerialNumberToString(n *big.Int) string
- func SetupLogger(currentLevel config.LogLevel, serviceID string, subsystem string) *logrus.Entry
- func SubjectToPkixName(subj models.Subject) pkix.Name
- func ValidateCAExpiration(expiration models.Expiration, caExp time.Time) bool
- func ValidateCertAndPrivKey(cert *x509.Certificate, rsaKey *rsa.PrivateKey, ecKey *ecdsa.PrivateKey) (bool, error)
- func ValidateCertificate(ca, cert *x509.Certificate, considerExpiration bool) error
- func ValidateExpirationTimeRef(input models.Expiration) bool
Constants ¶
This section is empty.
Variables ¶
View Source
var LogFormatter = &formatter.Formatter{ TimestampFormat: "2006-01-02 15:04:05", HideKeys: true, FieldsOrder: []string{"src", "auth-mode", "auth-id", "req-id", "service", "subsystem", "subsystem-provider"}, CallerFirst: true, CustomCallerFormatter: func(f *runtime.Frame) string { filename := path.Base(f.File) return fmt.Sprintf(" [%s %s():%d]", filename, f.Function, f.Line) }, }
Functions ¶
func CalculateECDSAKeySizes ¶
func CalculateRSAKeySizes ¶
func CertificateToPEM ¶
func CertificateToPEM(c *x509.Certificate) string
func ConfigureLogger ¶
func DecryptWithPrivateKey ¶
func DecryptWithPrivateKey(ciphertext []byte, priv *rsa.PrivateKey) ([]byte, error)
DecryptWithPrivateKey decrypts data with private key
func EncryptWithPublicKey ¶
EncryptWithPublicKey encrypts data with public key
func GenerateCertificateRequest ¶
defined to generate certificates with RSA and ECDSA keys
func GenerateCertificateRequestWithExtensions ¶ added in v2.4.2
func GenerateCertificateRequestWithExtensions(subject models.Subject, extensions []pkix.Extension, key any) (*x509.CertificateRequest, error)
defined to generate certificates with RSA and ECDSA keys
func GenerateECDSAKey ¶
func GenerateECDSAKey(curve elliptic.Curve) (*ecdsa.PrivateKey, error)
func GenerateRSAKey ¶
func GenerateRSAKey(bits int) (*rsa.PrivateKey, error)
func GenerateSelfSignedCA ¶ added in v2.4.2
func GenerateSelfSignedCA(keyType x509.PublicKeyAlgorithm, expirationTime time.Duration, commonName string) (*x509.Certificate, any, error)
func GetMetadataToStruct ¶
func InitContext ¶ added in v2.5.1
func KeyStrengthMetadataFromCertificate ¶
func KeyStrengthMetadataFromCertificate(cert *x509.Certificate) models.KeyStrengthMetadata
func LoadSytemCACertPool ¶
func ParseCertificate ¶
func ParseCertificate(cert string) (*x509.Certificate, error)
func ParsePrivateKey ¶
func PkixNameToString ¶
func PrivateKeyToPEM ¶
func ReadCertificateFromFile ¶
func ReadCertificateFromFile(filePath string) (*x509.Certificate, error)
func ReadPrivateKeyFromFile ¶
func SerialNumberToString ¶
func SetupLogger ¶ added in v2.5.1
func ValidateCAExpiration ¶
func ValidateCAExpiration(expiration models.Expiration, caExp time.Time) bool
func ValidateCertAndPrivKey ¶
func ValidateCertAndPrivKey(cert *x509.Certificate, rsaKey *rsa.PrivateKey, ecKey *ecdsa.PrivateKey) (bool, error)
func ValidateCertificate ¶
func ValidateCertificate(ca, cert *x509.Certificate, considerExpiration bool) error
func ValidateExpirationTimeRef ¶
func ValidateExpirationTimeRef(input models.Expiration) bool
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.