shamir

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package keytool

@author: xwc1125

Package keytool

Package keytool

Index

Constants

View Source
const (
	// EncodingHEX ...
	EncodingHEX = "hex"
	// EncodingBASE64 ...
	EncodingBASE64 = "base64"
	// EncodingAES ...
	EncodingAES = "aes"

	// SssTypeGalois ...
	SssTypeGalois = "galois"
	// SssTypeGf256 ...
	SssTypeGf256 = "gf256"
)

Variables

This section is empty.

Functions

func AesDecryptCBC

func AesDecryptCBC(encrypted []byte, key []byte) (decrypted []byte)

func AesDecryptCBCFromBase64

func AesDecryptCBCFromBase64(encrypted string, key string) (decrypted string)

func AesDecryptCFB

func AesDecryptCFB(encrypted []byte, key []byte) (decrypted []byte)

func AesDecryptCFBFromBase64

func AesDecryptCFBFromBase64(encrypted string, key string) (decrypted string)

func AesDecryptECB

func AesDecryptECB(encrypted []byte, key []byte) (decrypted []byte)

func AesDecryptECBFromBase64

func AesDecryptECBFromBase64(encrypted string, key string) (decrypted string)

func AesEncryptCBC

func AesEncryptCBC(origData []byte, key []byte) (encrypted []byte)

func AesEncryptCBCToBase64

func AesEncryptCBCToBase64(origData string, key string) (encrypted string)

func AesEncryptCFB

func AesEncryptCFB(origData []byte, key []byte) (encrypted []byte)

func AesEncryptCFBToBase64

func AesEncryptCFBToBase64(origData string, key string) (encrypted string)

=================== CFB ======================

func AesEncryptECB

func AesEncryptECB(origData []byte, key []byte) (encrypted []byte)

func AesEncryptECBToBase64

func AesEncryptECBToBase64(origData string, key string) (encrypted string)

=================== ECB ======================

func Decrypt

func Decrypt(sssType string, shares string, encoding, pwd string) ([]byte, error)

Decrypt 恢复私钥 sssType:shamir的方式(galois,gf256) shares:需要恢复私钥的密码片集,密钥片之间用”,“分割 encoding:Encrypt时输出的结果类型(hex,base64,aes) pwd:当encoding=aes时,使用pwd进行加密返回结果

func Encrypt

func Encrypt(parts, threshold int, sssType string, secret string, isSecretHex bool, encoding, pwd string) ([]byte, error)

Encrypt 分片

parts:私钥总分片数量 threshold:门限数 sssType:shamir的方式(galois,gf256) secret:需要分片的私钥 isSecretHex:私钥是否时16进制 encoding:Encrypt时输出的结果类型(hex,base64,aes) pwd:当encoding=aes时,使用pwd进行加密返回结果

Types

This section is empty.

Jump to

Keyboard shortcuts

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