func (t *RSA) PackGivenD(d *fmp.Fmpz) {
	t.Key.D = new(fmp.Fmpz).Set(d)
	if t.CipherText != nil && t.PlainText == nil {
		t.PlainText = ln.NumberToBytes(new(fmp.Fmpz).Exp(ln.BytesToNumber(t.CipherText), t.Key.D, t.Key.PublicKey.N))
	}
}
PackGivenD takes d and packs it into the key, solving for any ciphertext on the way.
package keys
import (
	"encoding/pem"
	"fmt"
	"log"
	"math/big"
	"github.com/sourcekris/goRsaTool/ln"
	"github.com/sourcekris/x509big"
	fmp "github.com/sourcekris/goflint"
)
type RSA struct {
	Key            FMPPrivateKey
	CipherText     []byte
	PlainText      []byte
	KnownPlainText []byte
	DLSB           []byte
	KeyFilename    string
	PastPrimesFile string
	NumPrimes      int
	Verbose        bool
	Log            *log.Logger
}
func NewRSA(key *FMPPrivateKey, c []byte, m []byte, pf string, v bool) (*RSA, error) {
	var pastPrimesFile string
	if pf != "" {
		pastPrimesFile = pf
	}
	var cipherText []byte
	if c != nil {
		cipherText = c
	}
	return &RSA{
		Key:            *key,
		PastPrimesFile: pastPrimesFile,
		CipherText:     cipherText,
		Verbose:        v,
	}, nil
}
func (t *RSA) PackGivenP(p *fmp.Fmpz) {
	q := new(fmp.Fmpz).Div(t.Key.N, p)
	t.Key.Primes = []*fmp.Fmpz{p, q}
	t.Key.D = ln.SolveforD(p, q, t.Key.PublicKey.E)
	if t.CipherText != nil && t.PlainText == nil {
		t.PlainText = ln.NumberToBytes(new(fmp.Fmpz).Exp(ln.BytesToNumber(t.CipherText), t.Key.D, t.Key.PublicKey.N))
	}
}
func (t *RSA) PackMultiPrime(primes []*fmp.Fmpz) error {
	var (
		n  = fmp.NewFmpz(1)
		cp = fmp.NewFmpz(1)
	)
	for _, p := range primes {
		n.MulZ(p)
		cp.MulZ(new(fmp.Fmpz).Sub(p, ln.BigOne))
	}
	if !n.Equals(t.Key.N) {
		return fmt.Errorf("product of primes does not equal N")
	}
	t.Key.Primes = primes
	t.Key.D = new(fmp.Fmpz).ModInverse(t.Key.PublicKey.E, cp)
	if t.CipherText != nil && t.PlainText == nil {
		t.PlainText = ln.NumberToBytes(new(fmp.Fmpz).Exp(ln.BytesToNumber(t.CipherText), t.Key.D, t.Key.PublicKey.N))
	}
	return nil
}