diff --git a/build.sh b/build.sh index 53f2961..51fc2ce 100755 --- a/build.sh +++ b/build.sh @@ -1,19 +1,19 @@ #!/bin/bash # Copyright (c) 2019-2021 GMO GlobalSign Pte. Ltd. -# +# # Licensed under the MIT License (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at -# +# # https://opensource.org/licenses/MIT -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# Check, build, test the hvclient. +# Check, build, test the hvclient. gofumports -d ./. && golint ./... && go build ./... && diff --git a/internal/pki/pem.go b/internal/pki/pem.go index 466c000..498cf44 100644 --- a/internal/pki/pem.go +++ b/internal/pki/pem.go @@ -83,7 +83,11 @@ func PrivateKeyFromFileWithPassword(filename, password string) (interface{}, err return rsakey, nil } - return nil, errors.New("unsupported private key type") + if rsakey, err := x509.ParsePKCS8PrivateKey(keybytes); err == nil { + return rsakey, nil + } + + return nil, errors.New("unsupported private key type DAVE") } // PublicKeyFromFile reads a PEM-encoded file and returns the public key it