boring

package
v0.0.0-...-bbc9f4b Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: BSD-3-Clause, BSD-3-Clause, ISC, + 1 more Imports: 12 Imported by: 0

Documentation

Overview

Package boring provides access to BoringCrypto implementation functions. Check the constant Enabled to find out whether BoringCrypto is available. If BoringCrypto is not available, the functions in this package all panic.

Index

Constants

View Source
const Enabled = available

Enabled reports whether BoringCrypto is available. When enabled is false, all functions in this package panic.

BoringCrypto is only available on linux/amd64 systems.

View Source
const RandReader = randReader(0)

Variables

This section is empty.

Functions

func DecryptRSANoPadding

func DecryptRSANoPadding(priv *PrivateKeyRSA, ciphertext []byte) ([]byte, error)

func DecryptRSAOAEP

func DecryptRSAOAEP(h hash.Hash, priv *PrivateKeyRSA, ciphertext, label []byte) ([]byte, error)

func DecryptRSAPKCS1

func DecryptRSAPKCS1(priv *PrivateKeyRSA, ciphertext []byte) ([]byte, error)

func EncryptRSANoPadding

func EncryptRSANoPadding(pub *PublicKeyRSA, msg []byte) ([]byte, error)

func EncryptRSAOAEP

func EncryptRSAOAEP(h hash.Hash, pub *PublicKeyRSA, msg, label []byte) ([]byte, error)

func EncryptRSAPKCS1

func EncryptRSAPKCS1(pub *PublicKeyRSA, msg []byte) ([]byte, error)

func GenerateKeyECDSA

func GenerateKeyECDSA(curve string) (X, Y, D *big.Int, err error)

func GenerateKeyRSA

func GenerateKeyRSA(bits int) (N, E, D, P, Q, Dp, Dq, Qinv *big.Int, err error)

func NewAESCipher

func NewAESCipher(key []byte) (cipher.Block, error)

func NewHMAC

func NewHMAC(h func() hash.Hash, key []byte) hash.Hash

NewHMAC returns a new HMAC using BoringCrypto. The function h must return a hash implemented by BoringCrypto (for example, h could be boring.NewSHA256). If h is not recognized, NewHMAC returns nil.

func NewSHA1

func NewSHA1() hash.Hash

NewSHA1 returns a new SHA1 hash.

func NewSHA224

func NewSHA224() hash.Hash

NewSHA224 returns a new SHA224 hash.

func NewSHA256

func NewSHA256() hash.Hash

NewSHA256 returns a new SHA256 hash.

func NewSHA384

func NewSHA384() hash.Hash

NewSHA384 returns a new SHA384 hash.

func NewSHA512

func NewSHA512() hash.Hash

NewSHA512 returns a new SHA512 hash.

func SignECDSA

func SignECDSA(priv *PrivateKeyECDSA, hash []byte) (r, s *big.Int, err error)

func SignMarshalECDSA

func SignMarshalECDSA(priv *PrivateKeyECDSA, hash []byte) ([]byte, error)

func SignRSAPKCS1v15

func SignRSAPKCS1v15(priv *PrivateKeyRSA, h crypto.Hash, hashed []byte) ([]byte, error)

func SignRSAPSS

func SignRSAPSS(priv *PrivateKeyRSA, h crypto.Hash, hashed []byte, saltLen int) ([]byte, error)

func Unreachable

func Unreachable()

Unreachable marks code that should be unreachable when BoringCrypto is in use. It panics.

func UnreachableExceptTests

func UnreachableExceptTests()

UnreachableExceptTests marks code that should be unreachable when BoringCrypto is in use. It panics.

func VerifyECDSA

func VerifyECDSA(pub *PublicKeyECDSA, hash []byte, r, s *big.Int) bool

func VerifyRSAPKCS1v15

func VerifyRSAPKCS1v15(pub *PublicKeyRSA, h crypto.Hash, hashed, sig []byte) error

func VerifyRSAPSS

func VerifyRSAPSS(pub *PublicKeyRSA, h crypto.Hash, hashed, sig []byte, saltLen int) error

Types

type PrivateKeyECDSA

type PrivateKeyECDSA struct {
	// contains filtered or unexported fields
}

func NewPrivateKeyECDSA

func NewPrivateKeyECDSA(curve string, X, Y *big.Int, D *big.Int) (*PrivateKeyECDSA, error)

type PrivateKeyRSA

type PrivateKeyRSA struct {
	// contains filtered or unexported fields
}

func NewPrivateKeyRSA

func NewPrivateKeyRSA(N, E, D, P, Q, Dp, Dq, Qinv *big.Int) (*PrivateKeyRSA, error)

type PublicKeyECDSA

type PublicKeyECDSA struct {
	// contains filtered or unexported fields
}

func NewPublicKeyECDSA

func NewPublicKeyECDSA(curve string, X, Y *big.Int) (*PublicKeyECDSA, error)

type PublicKeyRSA

type PublicKeyRSA struct {
	// contains filtered or unexported fields
}

func NewPublicKeyRSA

func NewPublicKeyRSA(N, E *big.Int) (*PublicKeyRSA, error)

Directories

Path Synopsis
Package fipstls allows control over whether crypto/tls requires FIPS-approved settings.
Package fipstls allows control over whether crypto/tls requires FIPS-approved settings.
Package sig holds “code signatures” that can be called and will result in certain code sequences being linked into the final binary.
Package sig holds “code signatures” that can be called and will result in certain code sequences being linked into the final binary.

Jump to

Keyboard shortcuts

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