mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-10-30 18:22:49 -04:00 
			
		
		
		
	Merge pull request #641 from hkjn/fix-build-acme-crypt
https: Fix build after https://github.com/xenolf/lego/commit/0e26b
This commit is contained in:
		
						commit
						43c339c7e3
					
				| @ -34,7 +34,16 @@ var NewACMEClient = func(email string, allowPrompts bool) (*ACMEClient, error) { | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// The client facilitates our communication with the CA server. | 	// The client facilitates our communication with the CA server. | ||||||
| 	client, err := acme.NewClient(CAUrl, &leUser, rsaKeySizeToUse) | 	var kt acme.KeyType | ||||||
|  | 	if rsaKeySizeToUse == Rsa2048 { | ||||||
|  | 		kt = acme.RSA2048 | ||||||
|  | 	} else if rsaKeySizeToUse == Rsa4096 { | ||||||
|  | 		kt = acme.RSA4096 | ||||||
|  | 	} else { | ||||||
|  | 		// TODO(hkjn): Support more types? Current changes are quick fix for #640. | ||||||
|  | 		return nil, fmt.Errorf("https: unsupported keysize") | ||||||
|  | 	} | ||||||
|  | 	client, err := acme.NewClient(CAUrl, &leUser, kt) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, err | 		return nil, err | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -11,7 +11,9 @@ import ( | |||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| func init() { | func init() { | ||||||
| 	rsaKeySizeToUse = 128 // make tests faster; small key size OK for testing | 	rsaKeySizeToUse = 2048 // TODO(hkjn): Bring back support for small | ||||||
|  | 	// keys to speed up tests? Current changes | ||||||
|  | 	// are quick fix for #640. | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestSaveAndLoadRSAPrivateKey(t *testing.T) { | func TestSaveAndLoadRSAPrivateKey(t *testing.T) { | ||||||
|  | |||||||
| @ -2,6 +2,7 @@ package https | |||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"bufio" | 	"bufio" | ||||||
|  | 	"crypto" | ||||||
| 	"crypto/rand" | 	"crypto/rand" | ||||||
| 	"crypto/rsa" | 	"crypto/rsa" | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| @ -34,7 +35,7 @@ func (u User) GetRegistration() *acme.RegistrationResource { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // GetPrivateKey gets u's private key. | // GetPrivateKey gets u's private key. | ||||||
| func (u User) GetPrivateKey() *rsa.PrivateKey { | func (u User) GetPrivateKey() crypto.PrivateKey { | ||||||
| 	return u.key | 	return u.key | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user