The PKCS8 changes updated the encryption on the keys so that the
`x509.IsEncryptedPEMBlock` may no longer return true because it cannot
parse the PEM block. The `keyutils` module in SwarmKit can tell whether
it is encrypted either way.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -4,7 +4,6 @@ package main |
| 4 | 4 |
|
| 5 | 5 |
import ( |
| 6 | 6 |
"bytes" |
| 7 |
- "crypto/x509" |
|
| 8 | 7 |
"encoding/json" |
| 9 | 8 |
"encoding/pem" |
| 10 | 9 |
"fmt" |
| ... | ... |
@@ -25,6 +24,7 @@ import ( |
| 25 | 25 |
"github.com/docker/libnetwork/driverapi" |
| 26 | 26 |
"github.com/docker/libnetwork/ipamapi" |
| 27 | 27 |
remoteipam "github.com/docker/libnetwork/ipams/remote/api" |
| 28 |
+ "github.com/docker/swarmkit/ca/keyutils" |
|
| 28 | 29 |
"github.com/go-check/check" |
| 29 | 30 |
"github.com/gotestyourself/gotestyourself/fs" |
| 30 | 31 |
"github.com/gotestyourself/gotestyourself/icmd" |
| ... | ... |
@@ -1007,7 +1007,7 @@ func checkKeyIsEncrypted(d *daemon.Swarm) func(*check.C) (interface{}, check.Com
|
| 1007 | 1007 |
return fmt.Errorf("invalid PEM-encoded private key"), nil
|
| 1008 | 1008 |
} |
| 1009 | 1009 |
|
| 1010 |
- return x509.IsEncryptedPEMBlock(keyBlock), nil |
|
| 1010 |
+ return keyutils.IsEncryptedPEMBlock(keyBlock), nil |
|
| 1011 | 1011 |
} |
| 1012 | 1012 |
} |
| 1013 | 1013 |
|