crypto

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bech32Decode

func Bech32Decode(in string) (interface{}, error)

Bech32Decode decodes given bech32 encoded string.

func DecryptJWE

func DecryptJWE(key, token string) (interface{}, error)

DecryptJWE decrypt a JWE token.

func EncryptJWE

func EncryptJWE(key string, payload interface{}) (string, error)

EncryptJWE encrypts input as JWE token.

func EncryptPEM

func EncryptPEM(pemData, passphrase string) (string, error)

EncryptPEM returns an encrypted PEM block using the given passphrase.

func FromJWK

func FromJWK(jwk string) (interface{}, error)

FromJWK parses a JWK and return wrapped keys.

func Key

func Key(keyType string) (string, error)

Key generates symmetric encryption keys according to given keyType.

func KeyToBytes

func KeyToBytes(key interface{}) ([]byte, error)

KeyToBytes encodes the given crypto key as a byte array.

func Keypair

func Keypair(keyType string) (interface{}, error)

Keypair generates crypto keys according to given key type.

func ParseJWT

func ParseJWT(token string) (interface{}, error)

ParseJWT unpack a JWT without signature verification.

func ToJWK

func ToJWK(key interface{}) (string, error)

ToJWK encodes given key using JWK.

func ToJWS

func ToJWS(payload, privkey interface{}) (string, error)

ToJWS returns a JWT token.

func ToPEM

func ToPEM(key interface{}) (string, error)

ToPEM encodes the given key using PEM.

func ToSSH

func ToSSH(key interface{}) (string, error)

ToSSH encodes the given key as SSH key.

func ToTLSA

func ToTLSA(selector, mtype uint8, cert *x509.Certificate) (string, error)

ToTLSA encodes the given certificate using TLSA encoding strategy. selector 0 - Raw / 1 - Public Key mtype 0 - Raw / 1 - SHA256 / 2 - SHA512.

func VerifyJWT

func VerifyJWT(token string, key interface{}) (interface{}, error)

Types

This section is empty.

Directories

Path Synopsis
Package bech32 is a modified version of the reference implementation of BIP173.
Package bech32 is a modified version of the reference implementation of BIP173.

Jump to

Keyboard shortcuts

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