crypt

package
v0.0.0-...-bf7a25e Latest Latest
Warning

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

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

Documentation

Overview

Package crypt implements PKCS#7 padding, as defined in RFC 5652. 源码: https://github.com/zenazn/pkcs7pad 标准:https://datatracker.ietf.org/doc/rfc2315/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(key, iv []byte, cipherText string) ([]byte, error)

Decrypt AES/CBC/PKCS#7

func Encrypt

func Encrypt(key, iv, data []byte) (string, error)

Encrypt AES/CBC/PKCS#7

func HmacDigest

func HmacDigest(key []byte, data string) string

HmacDigest hmac数据摘要

func Pad

func Pad(buf []byte, size int) []byte

Pad appends PKCS#7 padding to the given buffer such that the resulting slice of bytes has a length divisible by the given size. If you are using this function to pad a plaintext before encrypting it with a block cipher, the size should be equal to the block size of the cipher (e.g., aes.BlockSize).

func Unpad

func Unpad(buf []byte) ([]byte, error)

Unpad returns a subslice of the input buffer with trailing PKCS#7 padding removed. It checks the correctness of the padding bytes in constant time, and returns an error if the padding bytes are malformed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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