|
@@ -68,10 +68,17 @@ func NewECDSAPrivateKey(currentTime time.Time, priv *ecdsa.PrivateKey) *PrivateK
|
|
|
// implements RSA or ECDSA.
|
|
// implements RSA or ECDSA.
|
|
|
func NewSignerPrivateKey(currentTime time.Time, signer crypto.Signer) *PrivateKey {
|
|
func NewSignerPrivateKey(currentTime time.Time, signer crypto.Signer) *PrivateKey {
|
|
|
pk := new(PrivateKey)
|
|
pk := new(PrivateKey)
|
|
|
|
|
+ // In general, the public Keys should be used as pointers. We still
|
|
|
|
|
+ // type-switch on the values, for backwards-compatibility.
|
|
|
switch pubkey := signer.Public().(type) {
|
|
switch pubkey := signer.Public().(type) {
|
|
|
|
|
+ case *rsa.PublicKey:
|
|
|
|
|
+ pk.PublicKey = *NewRSAPublicKey(currentTime, pubkey)
|
|
|
|
|
+ pk.PubKeyAlgo = PubKeyAlgoRSASignOnly
|
|
|
case rsa.PublicKey:
|
|
case rsa.PublicKey:
|
|
|
pk.PublicKey = *NewRSAPublicKey(currentTime, &pubkey)
|
|
pk.PublicKey = *NewRSAPublicKey(currentTime, &pubkey)
|
|
|
pk.PubKeyAlgo = PubKeyAlgoRSASignOnly
|
|
pk.PubKeyAlgo = PubKeyAlgoRSASignOnly
|
|
|
|
|
+ case *ecdsa.PublicKey:
|
|
|
|
|
+ pk.PublicKey = *NewECDSAPublicKey(currentTime, pubkey)
|
|
|
case ecdsa.PublicKey:
|
|
case ecdsa.PublicKey:
|
|
|
pk.PublicKey = *NewECDSAPublicKey(currentTime, &pubkey)
|
|
pk.PublicKey = *NewECDSAPublicKey(currentTime, &pubkey)
|
|
|
default:
|
|
default:
|