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
- func DecryptRSANoPadding(priv *PrivateKeyRSA, ciphertext []byte) ([]byte, error)
- func DecryptRSAOAEP(h hash.Hash, priv *PrivateKeyRSA, ciphertext, label []byte) ([]byte, error)
- func DecryptRSAPKCS1(priv *PrivateKeyRSA, ciphertext []byte) ([]byte, error)
- func EncryptRSANoPadding(pub *PublicKeyRSA, msg []byte) ([]byte, error)
- func EncryptRSAOAEP(h hash.Hash, pub *PublicKeyRSA, msg, label []byte) ([]byte, error)
- func EncryptRSAPKCS1(pub *PublicKeyRSA, msg []byte) ([]byte, error)
- func GenerateKeyECDSA(curve string) (X, Y, D *big.Int, err error)
- func GenerateKeyRSA(bits int) (N, E, D, P, Q, Dp, Dq, Qinv *big.Int, err error)
- func NewAESCipher(key []byte) (cipher.Block, error)
- func NewHMAC(h func() hash.Hash, key []byte) hash.Hash
- func NewSHA1() hash.Hash
- func NewSHA224() hash.Hash
- func NewSHA256() hash.Hash
- func NewSHA384() hash.Hash
- func NewSHA512() hash.Hash
- func SignECDSA(priv *PrivateKeyECDSA, hash []byte) (r, s *big.Int, err error)
- func SignMarshalECDSA(priv *PrivateKeyECDSA, hash []byte) ([]byte, error)
- func SignRSAPKCS1v15(priv *PrivateKeyRSA, h crypto.Hash, hashed []byte) ([]byte, error)
- func SignRSAPSS(priv *PrivateKeyRSA, h crypto.Hash, hashed []byte, saltLen int) ([]byte, error)
- func Unreachable()
- func UnreachableExceptTests()
- func VerifyECDSA(pub *PublicKeyECDSA, hash []byte, r, s *big.Int) bool
- func VerifyRSAPKCS1v15(pub *PublicKeyRSA, h crypto.Hash, hashed, sig []byte) error
- func VerifyRSAPSS(pub *PublicKeyRSA, h crypto.Hash, hashed, sig []byte, saltLen int) error
- type PrivateKeyECDSA
- type PrivateKeyRSA
- type PublicKeyECDSA
- type PublicKeyRSA
Constants ¶
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.
const RandReader = randReader(0)
Variables ¶
This section is empty.
Functions ¶
func DecryptRSANoPadding ¶
func DecryptRSANoPadding(priv *PrivateKeyRSA, ciphertext []byte) ([]byte, error)
func DecryptRSAOAEP ¶
func DecryptRSAPKCS1 ¶
func DecryptRSAPKCS1(priv *PrivateKeyRSA, ciphertext []byte) ([]byte, error)
func EncryptRSANoPadding ¶
func EncryptRSANoPadding(pub *PublicKeyRSA, msg []byte) ([]byte, error)
func EncryptRSAOAEP ¶
func EncryptRSAPKCS1 ¶
func EncryptRSAPKCS1(pub *PublicKeyRSA, msg []byte) ([]byte, error)
func GenerateKeyRSA ¶
func NewHMAC ¶
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 SignMarshalECDSA ¶
func SignMarshalECDSA(priv *PrivateKeyECDSA, hash []byte) ([]byte, error)
func SignRSAPKCS1v15 ¶
func SignRSAPSS ¶
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 ¶
Types ¶
type PrivateKeyECDSA ¶
type PrivateKeyECDSA struct {
// contains filtered or unexported fields
}
func NewPrivateKeyECDSA ¶
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. |