security

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package utils @Description: Operation with rsa encryption

Index

Constants

View Source
const (
	DefaultAesKey   = `159054a86e3bfb85b5f1991cdb07645e`
	BlockSize       = 16 // block size fixed at 16 bytes / 128 bits (Nb=4) for AES
	DefaultAesNBits = 256
)

Variables

This section is empty.

Functions

func CiphertextFormat

func CiphertextFormat(ciphertext string) string

CiphertextFormat Client encrypt content format

func CiphertextReplace

func CiphertextReplace(ciphertext string) string

func ComparePassword

func ComparePassword(hashedPassword, currPassword string, saltStr string) bool

ComparePassword Check if two passwords compare

func DecodeURIComponent

func DecodeURIComponent(str string) string

func EncodeURIComponent

func EncodeURIComponent(str string) string

func NewAesCipher

func NewAesCipher(key string, nBits int) (*aesCipher, error)

func RandInt

func RandInt(min, max int) int

func Rc4ClientDecrypt

func Rc4ClientDecrypt(ciphertext string) (string, error)

Rc4ClientDecrypt Client RC4 Config file Decrypt

func Rc4ClientEncrypt

func Rc4ClientEncrypt(plaintext string) (string, error)

Rc4ClientEncrypt Client RC4 Config file Encrypt

func Rc4Decrypt

func Rc4Decrypt(ciphertext string, key string) (string, error)

func Rc4Encrypt

func Rc4Encrypt(plaintext string, key string) (string, error)

func RsaDecrypt

func RsaDecrypt(cryptText, priKey string) (plainText []byte, err error)

func RsaEncrypt

func RsaEncrypt(plainText, pubKey string) (cryptText string, err error)

Types

type AesKeySizeError

type AesKeySizeError int

func (AesKeySizeError) Error

func (k AesKeySizeError) Error() string

type Encrypt

type Encrypt struct {
	Password string
	Salt     string
}

func EncryptPassword

func EncryptPassword(password string) *Encrypt

Jump to

Keyboard shortcuts

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