Skip to content

Commit

Permalink
Merge pull request #27 from globalsign/allow_pkcs8_private_keys
Browse files Browse the repository at this point in the history
Allowing PKCS8 Private keys
  • Loading branch information
toddgaunt-gs authored Jun 13, 2023
2 parents 9ca28b7 + f6d066e commit ecd095e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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 ./... &&
Expand Down
4 changes: 4 additions & 0 deletions internal/pki/pem.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ func PrivateKeyFromFileWithPassword(filename, password string) (interface{}, err
return rsakey, nil
}

if rsakey, err := x509.ParsePKCS8PrivateKey(keybytes); err == nil {
return rsakey, nil
}

return nil, errors.New("unsupported private key type")
}

Expand Down

0 comments on commit ecd095e

Please sign in to comment.