Standard library / crypto/rsa

crypto/rsa.PrecomputedValues

Dp, Dq and Qinv accelerate RSA operations; CRTValues is deprecated compatibility data for extra primes. Do not mutate. Treat as secret. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
type PrecomputedValues struct {  Dp, Dq *big.Int // D mod (P-1) (or mod Q-1)  Qinv   *big.Int // Q^-1 mod P
  CRTValues []CRTValue
}

Working Example

Example Snippetgo
package main
import (  "crypto/rand"  "crypto/rsa"  "fmt")
func main() {  k := must(rsa.GenerateKey(rand.Reader, 2048))  var v rsa.PrecomputedValues = k.Precomputed  fmt.Println(v.Dp != nil && v.Dq != nil && v.Qinv != nil)}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)  }}
Go Reference