Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalPKCS1BigPrivateKey ¶
func MarshalPKCS1BigPrivateKey(key *BigPrivateKey) []byte
MarshalPKCS1BigPrivateKey converts a big private key to ASN.1 DER encoded form. Taken from the standard library
func MarshalPKCS1BigPublicKey ¶
func MarshalPKCS1BigPublicKey(key *BigPublicKey) []byte
MarshalPKCS1BigPublicKey converts a big public key to ASN.1 DER encoded form.
Types ¶
type BigPrivateKey ¶
type BigPrivateKey struct {
PublicKey BigPublicKey // public part.
D *big.Int // private exponent
Primes []*big.Int // prime factors of N, has >= 2 elements.
// Precomputed contains precomputed values that speed up private
// operations, if available.
Precomputed PrecomputedValues
}
BigPrivateKey is a big private key type
func ParseBigPKCS1PrivateKey ¶
func ParseBigPKCS1PrivateKey(der []byte) (*BigPrivateKey, error)
ParseBigPKCS1PrivateKey returns an RSA private key from its ASN.1 PKCS#1 DER encoded form.
type BigPublicKey ¶
BigPublicKey is big.Int public key type
func ParseBigPKCS1PublicKey ¶
func ParseBigPKCS1PublicKey(der []byte) (*BigPublicKey, error)
ParseBigPKCS1PublicKey parses an RSA public key in PKCS#1, ASN.1 DER form.
func ParseBigPKIXPublicKey ¶
func ParseBigPKIXPublicKey(derBytes []byte) (*BigPublicKey, error)
ParseBigPKIXPublicKey parses a DER encoded public key. These values are typically found in PEM blocks with "BEGIN PUBLIC KEY".
type CRTValue ¶
type CRTValue struct {
Exp *big.Int // D mod (prime-1).
Coeff *big.Int // R·Coeff ≡ 1 mod Prime.
R *big.Int // product of primes prior to this (inc p and q).
}
CRTValue contains the precomputed Chinese remainder theorem values. directly taken from standard library rsa.CRTValues
type PrecomputedValues ¶
type PrecomputedValues struct {
Dp, Dq *big.Int // D mod (P-1) (or mod Q-1)
Qinv *big.Int // Q^-1 mod P
// CRTValues is used for the 3rd and subsequent primes. Due to a
// historical accident, the CRT for the first two primes is handled
// differently in PKCS#1 and interoperability is sufficiently
// important that we mirror this.
CRTValues []CRTValue
}
PrecomputedValues is directly taken from standard library rsa.PrecomputedValues using big.Int types.