Fix linter warning
This commit is contained in:
parent
1c7de4fc91
commit
9fe172e8f2
1 changed files with 4 additions and 3 deletions
|
@ -384,9 +384,10 @@ func (r *TorObfs4StateResource) deriveNodeIdFromRsaKey(rsaPrivateKeyPem string)
|
|||
var err error
|
||||
|
||||
// Try different RSA private key formats
|
||||
if block.Type == "RSA PRIVATE KEY" {
|
||||
switch block.Type {
|
||||
case "RSA PRIVATE KEY":
|
||||
privateKey, err = x509.ParsePKCS1PrivateKey(block.Bytes)
|
||||
} else if block.Type == "PRIVATE KEY" {
|
||||
case "PRIVATE KEY":
|
||||
parsedKey, err2 := x509.ParsePKCS8PrivateKey(block.Bytes)
|
||||
if err2 == nil {
|
||||
var ok bool
|
||||
|
@ -397,7 +398,7 @@ func (r *TorObfs4StateResource) deriveNodeIdFromRsaKey(rsaPrivateKeyPem string)
|
|||
} else {
|
||||
err = err2
|
||||
}
|
||||
} else {
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported PEM block type: %s", block.Type)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue