crypto

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2019 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const (
	SignType_SHA256WithRSA = "SHA256WithRSA"
	SignType_MD5           = "MD5"
)

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(data []byte, method string, key ...[]byte) ([]byte, error)

func Encrypt

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

func PKCS1PrivateKey

func PKCS1PrivateKey(key []byte) (*rsa.PrivateKey, error)

func PKCS1PublicKey

func PKCS1PublicKey(key []byte) (*rsa.PublicKey, error)

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blockSize int) []byte

使用PKCS7进行填充,IOS也是7

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

func PKCS8PrivateKey

func PKCS8PrivateKey(key []byte) (*rsa.PrivateKey, error)

func RSADecrypt

func RSADecrypt(ciphertext, privateKey []byte) ([]byte, error)

RSADecrypt 解密

func RSAEncrypt

func RSAEncrypt(origData, publicKey []byte) ([]byte, error)

RSAEncrypt 加密

func Sign

func Sign()

Types

type AESCipher

type AESCipher struct {
	Len        int
	PaddingLen int
}

func (*AESCipher) Decrypt

func (c *AESCipher) Decrypt(data []byte, key ...[]byte) ([]byte, error)

func (*AESCipher) Encrypt

func (c *AESCipher) Encrypt(data []byte, key ...[]byte) ([]byte, error)

type Base64Cipher

type Base64Cipher struct {
}

func (*Base64Cipher) Decrypt

func (*Base64Cipher) Decrypt(data []byte, key ...[]byte) ([]byte, error)

func (*Base64Cipher) Encrypt

func (*Base64Cipher) Encrypt(data []byte, key ...[]byte) ([]byte, error)

type Cipher

type Cipher interface {
	Encrypt(data []byte, key ...[]byte) ([]byte, error)
	Decrypt(data []byte, key ...[]byte) ([]byte, error)
}

type Signature

type Signature struct {
}

Jump to

Keyboard shortcuts

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