Standard library / crypto/rsa
crypto/rsa.ErrMessageTooLong
Input exceeds RSA encryption capacity. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
var ErrMessageTooLong errorWorking Example
Example Snippetgo
package main
import ( "crypto/rand" "crypto/rsa" "crypto/sha256" "errors" "fmt")
func main() { k := must(rsa.GenerateKey(rand.Reader, 2048)) _, err := rsa.EncryptOAEP(sha256.New(), rand.Reader, &k.PublicKey, make([]byte, 256), nil) fmt.Println(errors.Is(err, rsa.ErrMessageTooLong))}func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}