Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Putty
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
m-team
tools
packaging
upstream
Putty
Commits
ed29fdc9
Commit
ed29fdc9
authored
22 years ago
by
Simon Tatham
Browse files
Options
Downloads
Patches
Plain Diff
Add some basic framework code preparatory to adding key export.
[originally from svn r1675]
parent
82d2d94d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
import.c
+23
-0
23 additions, 0 deletions
import.c
puttygen.c
+41
-5
41 additions, 5 deletions
puttygen.c
ssh.h
+3
-0
3 additions, 0 deletions
ssh.h
with
67 additions
and
5 deletions
import.c
+
23
−
0
View file @
ed29fdc9
...
...
@@ -89,6 +89,29 @@ struct ssh2_userkey *import_ssh2(char *filename, int type, char *passphrase)
return
NULL
;
}
/*
* Export an SSH1 key.
*/
int
export_ssh1
(
char
*
filename
,
int
type
,
struct
RSAKey
*
key
,
char
*
passphrase
)
{
return
0
;
}
/*
* Export an SSH2 key.
*/
int
export_ssh2
(
char
*
filename
,
int
type
,
struct
ssh2_userkey
*
key
,
char
*
passphrase
)
{
#if 0
if (type == SSH_KEYTYPE_OPENSSH)
return openssh_write(filename, key, passphrase);
if (type == SSH_KEYTYPE_SSHCOM)
return sshcom_write(filename, key, passphrase);
#endif
return
0
;
}
/* ----------------------------------------------------------------------
* Helper routines. (The base64 ones are defined in sshpubk.c.)
*/
...
...
This diff is collapsed.
Click to expand it.
puttygen.c
+
41
−
5
View file @
ed29fdc9
...
...
@@ -800,12 +800,39 @@ static int CALLBACK MainDlgProc(HWND hwnd, UINT msg,
}
break
;
case
IDC_SAVE
:
case
IDC_EXPORT_OPENSSH
:
case
IDC_EXPORT_SSHCOM
:
state
=
(
struct
MainDlgState
*
)
GetWindowLong
(
hwnd
,
GWL_USERDATA
);
if
(
state
->
key_exists
)
{
char
filename
[
FILENAME_MAX
];
char
passphrase
[
PASSPHRASE_MAXLEN
];
char
passphrase2
[
PASSPHRASE_MAXLEN
];
int
type
,
realtype
;
if
(
state
->
ssh2
)
realtype
=
SSH_KEYTYPE_SSH2
;
else
realtype
=
SSH_KEYTYPE_SSH1
;
if
(
LOWORD
(
wParam
)
==
IDC_EXPORT_OPENSSH
)
type
=
SSH_KEYTYPE_OPENSSH
;
else
if
(
LOWORD
(
wParam
)
==
IDC_EXPORT_SSHCOM
)
type
=
SSH_KEYTYPE_SSHCOM
;
else
type
=
realtype
;
if
(
type
!=
realtype
&&
import_target_type
(
type
)
!=
realtype
)
{
char
msg
[
256
];
sprintf
(
msg
,
"Cannot export an SSH%d key in an SSH%d"
" format"
,
(
state
->
ssh2
?
2
:
1
),
(
state
->
ssh2
?
1
:
2
));
MessageBox
(
hwnd
,
msg
,
"PuTTYgen Error"
,
MB_OK
|
MB_ICONERROR
);
break
;
}
GetDlgItemText
(
hwnd
,
IDC_PASSPHRASE1EDIT
,
passphrase
,
sizeof
(
passphrase
));
GetDlgItemText
(
hwnd
,
IDC_PASSPHRASE2EDIT
,
...
...
@@ -840,13 +867,22 @@ static int CALLBACK MainDlgProc(HWND hwnd, UINT msg,
if
(
ret
!=
IDYES
)
break
;
}
if
(
state
->
ssh2
)
{
ret
=
ssh2_save_userkey
(
filename
,
&
state
->
ssh2key
,
*
passphrase
?
passphrase
:
NULL
);
if
(
type
!=
realtype
)
ret
=
export_ssh2
(
filename
,
type
,
&
state
->
ssh2key
,
*
passphrase
?
passphrase
:
NULL
);
else
ret
=
ssh2_save_userkey
(
filename
,
&
state
->
ssh2key
,
*
passphrase
?
passphrase
:
NULL
);
}
else
{
ret
=
saversakey
(
filename
,
&
state
->
key
,
*
passphrase
?
passphrase
:
NULL
);
if
(
type
!=
realtype
)
ret
=
export_ssh1
(
filename
,
type
,
&
state
->
key
,
*
passphrase
?
passphrase
:
NULL
);
else
ret
=
saversakey
(
filename
,
&
state
->
key
,
*
passphrase
?
passphrase
:
NULL
);
}
if
(
ret
<=
0
)
{
MessageBox
(
hwnd
,
"Unable to save key file"
,
...
...
This diff is collapsed.
Click to expand it.
ssh.h
+
3
−
0
View file @
ed29fdc9
...
...
@@ -311,6 +311,9 @@ int import_target_type(int type);
int
import_encrypted
(
char
*
filename
,
int
type
,
char
**
comment
);
int
import_ssh1
(
char
*
filename
,
int
type
,
struct
RSAKey
*
key
,
char
*
passphrase
);
struct
ssh2_userkey
*
import_ssh2
(
char
*
filename
,
int
type
,
char
*
passphrase
);
int
export_ssh1
(
char
*
filename
,
int
type
,
struct
RSAKey
*
key
,
char
*
passphrase
);
int
export_ssh2
(
char
*
filename
,
int
type
,
struct
ssh2_userkey
*
key
,
char
*
passphrase
);
void
des3_decrypt_pubkey
(
unsigned
char
*
key
,
unsigned
char
*
blk
,
int
len
);
void
des3_encrypt_pubkey
(
unsigned
char
*
key
,
unsigned
char
*
blk
,
int
len
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment