Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
0980d5c7
Unverified
Commit
0980d5c7
authored
Sep 06, 2023
by
Michael Yang
Committed by
GitHub
Sep 06, 2023
Browse files
Merge pull request #478 from jmorganca/mxyng/cleanup
remove unused openssh key types
parents
83c6be16
0dae34b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
81 deletions
+0
-81
format/openssh.go
format/openssh.go
+0
-81
No files found.
format/openssh.go
View file @
0980d5c7
...
@@ -10,15 +10,11 @@ package format
...
@@ -10,15 +10,11 @@ package format
import
(
import
(
"crypto"
"crypto"
"crypto/ecdsa"
"crypto/ed25519"
"crypto/ed25519"
"crypto/elliptic"
"crypto/rand"
"crypto/rand"
"crypto/rsa"
"encoding/binary"
"encoding/binary"
"encoding/pem"
"encoding/pem"
"fmt"
"fmt"
"math/big"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh"
)
)
...
@@ -41,25 +37,6 @@ type openSSHPrivateKey struct {
...
@@ -41,25 +37,6 @@ type openSSHPrivateKey struct {
Rest
[]
byte
`ssh:"rest"`
Rest
[]
byte
`ssh:"rest"`
}
}
type
openSSHRSAPrivateKey
struct
{
N
*
big
.
Int
E
*
big
.
Int
D
*
big
.
Int
Iqmp
*
big
.
Int
P
*
big
.
Int
Q
*
big
.
Int
Comment
string
Pad
[]
byte
`ssh:"rest"`
}
type
openSSHECDSAPrivateKey
struct
{
Curve
string
Pub
[]
byte
D
*
big
.
Int
Comment
string
Pad
[]
byte
`ssh:"rest"`
}
type
openSSHEd25519PrivateKey
struct
{
type
openSSHEd25519PrivateKey
struct
{
Pub
[]
byte
Pub
[]
byte
Priv
[]
byte
Priv
[]
byte
...
@@ -85,64 +62,6 @@ func OpenSSHPrivateKey(key crypto.PrivateKey, comment string) (*pem.Block, error
...
@@ -85,64 +62,6 @@ func OpenSSHPrivateKey(key crypto.PrivateKey, comment string) (*pem.Block, error
}
}
switch
k
:=
key
.
(
type
)
{
switch
k
:=
key
.
(
type
)
{
case
*
rsa
.
PrivateKey
:
e
:=
new
(
big
.
Int
)
.
SetInt64
(
int64
(
k
.
E
))
key
:=
openSSHRSAPrivateKey
{
N
:
k
.
N
,
E
:
e
,
D
:
k
.
D
,
Iqmp
:
k
.
Precomputed
.
Qinv
,
P
:
k
.
Primes
[
0
],
Q
:
k
.
Primes
[
1
],
Comment
:
comment
,
}
pk1
.
Keytype
=
ssh
.
KeyAlgoRSA
pk1
.
Rest
=
ssh
.
Marshal
(
key
)
w
.
PubKey
=
ssh
.
Marshal
(
struct
{
KeyType
string
E
*
big
.
Int
N
*
big
.
Int
}{
ssh
.
KeyAlgoRSA
,
e
,
k
.
N
,
})
case
*
ecdsa
.
PrivateKey
:
var
curve
,
keytype
string
switch
name
:=
k
.
Curve
.
Params
()
.
Name
;
name
{
case
"P-256"
:
curve
=
"nistp256"
keytype
=
ssh
.
KeyAlgoECDSA256
case
"P-384"
:
curve
=
"nistp384"
keytype
=
ssh
.
KeyAlgoECDSA384
case
"P-521"
:
curve
=
"nistp521"
keytype
=
ssh
.
KeyAlgoECDSA521
default
:
return
nil
,
fmt
.
Errorf
(
"ssh: unknown curve %q"
,
name
)
}
pub
:=
elliptic
.
Marshal
(
k
.
Curve
,
k
.
X
,
k
.
Y
)
key
:=
openSSHECDSAPrivateKey
{
Curve
:
curve
,
Pub
:
pub
,
D
:
k
.
D
,
Comment
:
comment
,
}
pk1
.
Keytype
=
keytype
pk1
.
Rest
=
ssh
.
Marshal
(
key
)
w
.
PubKey
=
ssh
.
Marshal
(
struct
{
KeyType
string
Curve
string
Pub
[]
byte
}{
keytype
,
curve
,
pub
,
})
case
ed25519
.
PrivateKey
:
case
ed25519
.
PrivateKey
:
pub
,
priv
:=
k
[
32
:
],
k
pub
,
priv
:=
k
[
32
:
],
k
key
:=
openSSHEd25519PrivateKey
{
key
:=
openSSHEd25519PrivateKey
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment