util

package
v2.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package util provides utility functions for the KMS backends.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRandomKey

func GetRandomKey(length int) ([]byte, error)

GetRandomKey reads length bytes from getrandom(2) if available, /dev/urandom otherwise.

func ParseDERtoPublicKeyRSA

func ParseDERtoPublicKeyRSA(pkDER []byte) (*rsa.PublicKey, error)

ParseDERtoPublicKeyRSA parses a PKIX, ASN.1 DER RSA public key from []byte to *rsa.PublicKey.

func ParsePEMtoPublicKeyRSA

func ParsePEMtoPublicKeyRSA(pkPEM []byte) (*rsa.PublicKey, error)

ParsePEMtoPublicKeyRSA parses a public RSA key from bytes to *rsa.PublicKey.

func UnwrapAES

func UnwrapAES(encryptedKey []byte, wrapKeyAES []byte) ([]byte, error)

UnwrapAES decrypts data wrapped with AES Key Wrap with Padding as specified in RFC 5649: https://datatracker.ietf.org/doc/html/rfc5649

Key sizes are limited to 16 and 32 Bytes.

func WrapAES

func WrapAES(key []byte, wrapKeyAES []byte) ([]byte, error)

WrapAES performs AES Key Wrap with Padding as specified in RFC 5649: https://datatracker.ietf.org/doc/html/rfc5649

Key sizes are limited to 16 and 32 Bytes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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