Match on prefix for certificates

This also gives support for signing with ssh certificates
- ssh-rsa-cert-v01@openssh.com
- ssh-ed25519-cert-v01@openssh.com
このコミットが含まれているのは:
Wim 2020-07-10 23:17:17 +02:00
コミット 38d400649c
1個のファイルの変更4行の追加3行の削除

ファイルの表示

@ -11,6 +11,7 @@ import (
"crypto"
"fmt"
"net/http"
"strings"
"time"
"golang.org/x/crypto/ssh"
@ -229,10 +230,10 @@ func NewSSHSigner(s ssh.Signer, dAlgo DigestAlgorithm, headers []string, scheme
}
func getSSHAlgorithm(pkType string) Algorithm {
switch pkType {
case sshPrefix + "-" + ed25519Prefix:
switch {
case strings.HasPrefix(pkType, sshPrefix+"-"+ed25519Prefix):
return ED25519
case sshPrefix + "-" + rsaPrefix:
case strings.HasPrefix(pkType, sshPrefix+"-"+rsaPrefix):
return RSA_SHA1
}