Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
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
Container Registry
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
4661e874
Commit
4661e874
authored
14 years ago
by
kh1
Browse files
Options
Downloads
Patches
Plain Diff
Fix missing member initialization.
Task-number: QTCREATORBUG-2694 Reviewed-by: ck
parent
82f80d54
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/coreplugin/ssh/sshkeygenerator.cpp
+14
-7
14 additions, 7 deletions
src/plugins/coreplugin/ssh/sshkeygenerator.cpp
src/plugins/coreplugin/ssh/sshkeygenerator.h
+1
-1
1 addition, 1 deletion
src/plugins/coreplugin/ssh/sshkeygenerator.h
with
15 additions
and
8 deletions
src/plugins/coreplugin/ssh/sshkeygenerator.cpp
+
14
−
7
View file @
4661e874
...
@@ -49,21 +49,28 @@ namespace Core {
...
@@ -49,21 +49,28 @@ namespace Core {
using
namespace
Botan
;
using
namespace
Botan
;
using
namespace
Internal
;
using
namespace
Internal
;
SshKeyGenerator
::
SshKeyGenerator
()
{
}
SshKeyGenerator
::
SshKeyGenerator
()
:
m_type
(
Rsa
)
,
m_format
(
OpenSsl
)
{
}
bool
SshKeyGenerator
::
generateKeys
(
KeyType
type
,
PrivateKeyFormat
format
,
bool
SshKeyGenerator
::
generateKeys
(
KeyType
type
,
PrivateKeyFormat
format
,
int
keySize
)
int
keySize
)
{
{
m_type
=
type
;
m_format
=
format
;
try
{
try
{
AutoSeeded_RNG
rng
;
AutoSeeded_RNG
rng
;
KeyPtr
key
;
KeyPtr
key
;
if
(
type
==
Rsa
)
if
(
m_
type
==
Rsa
)
key
=
KeyPtr
(
new
RSA_PrivateKey
(
rng
,
keySize
));
key
=
KeyPtr
(
new
RSA_PrivateKey
(
rng
,
keySize
));
else
else
key
=
KeyPtr
(
new
DSA_PrivateKey
(
rng
,
DL_Group
(
rng
,
DL_Group
::
Strong
,
key
=
KeyPtr
(
new
DSA_PrivateKey
(
rng
,
DL_Group
(
rng
,
DL_Group
::
Strong
,
keySize
)));
keySize
)));
return
format
==
Pkcs8
return
m_
format
==
Pkcs8
?
generatePkcs8Keys
(
key
)
:
generateOpenSslKeys
(
key
,
type
);
?
generatePkcs8Keys
(
key
)
:
generateOpenSslKeys
(
key
);
}
catch
(
Botan
::
Exception
&
e
)
{
}
catch
(
Botan
::
Exception
&
e
)
{
m_error
=
tr
(
"Error generating key: %1"
).
arg
(
e
.
what
());
m_error
=
tr
(
"Error generating key: %1"
).
arg
(
e
.
what
());
return
false
;
return
false
;
...
@@ -95,12 +102,12 @@ void SshKeyGenerator::generatePkcs8Key(const KeyPtr &key, bool privateKey)
...
@@ -95,12 +102,12 @@ void SshKeyGenerator::generatePkcs8Key(const KeyPtr &key, bool privateKey)
pipe
.
message_count
()
-
1
);
pipe
.
message_count
()
-
1
);
}
}
bool
SshKeyGenerator
::
generateOpenSslKeys
(
const
KeyPtr
&
key
,
KeyType
type
)
bool
SshKeyGenerator
::
generateOpenSslKeys
(
const
KeyPtr
&
key
)
{
{
QList
<
BigInt
>
publicParams
;
QList
<
BigInt
>
publicParams
;
QList
<
BigInt
>
allParams
;
QList
<
BigInt
>
allParams
;
QByteArray
keyId
;
QByteArray
keyId
;
if
(
type
==
Rsa
)
{
if
(
m_
type
==
Rsa
)
{
const
QSharedPointer
<
RSA_PrivateKey
>
rsaKey
const
QSharedPointer
<
RSA_PrivateKey
>
rsaKey
=
key
.
dynamicCast
<
RSA_PrivateKey
>
();
=
key
.
dynamicCast
<
RSA_PrivateKey
>
();
publicParams
<<
rsaKey
->
get_e
()
<<
rsaKey
->
get_n
();
publicParams
<<
rsaKey
->
get_e
()
<<
rsaKey
->
get_n
();
...
@@ -130,7 +137,7 @@ bool SshKeyGenerator::generateOpenSslKeys(const KeyPtr &key, KeyType type)
...
@@ -130,7 +137,7 @@ bool SshKeyGenerator::generateOpenSslKeys(const KeyPtr &key, KeyType type)
encoder
.
encode
(
b
);
encoder
.
encode
(
b
);
encoder
.
end_cons
();
encoder
.
end_cons
();
const
char
*
const
label
const
char
*
const
label
=
type
==
Rsa
?
"RSA PRIVATE KEY"
:
"DSA PRIVATE KEY"
;
=
m_
type
==
Rsa
?
"RSA PRIVATE KEY"
:
"DSA PRIVATE KEY"
;
m_privateKey
m_privateKey
=
QByteArray
(
PEM_Code
::
encode
(
encoder
.
get_contents
(),
label
).
c_str
());
=
QByteArray
(
PEM_Code
::
encode
(
encoder
.
get_contents
(),
label
).
c_str
());
return
true
;
return
true
;
...
...
This diff is collapsed.
Click to expand it.
src/plugins/coreplugin/ssh/sshkeygenerator.h
+
1
−
1
View file @
4661e874
...
@@ -61,7 +61,7 @@ private:
...
@@ -61,7 +61,7 @@ private:
bool
generatePkcs8Keys
(
const
KeyPtr
&
key
);
bool
generatePkcs8Keys
(
const
KeyPtr
&
key
);
void
generatePkcs8Key
(
const
KeyPtr
&
key
,
bool
privateKey
);
void
generatePkcs8Key
(
const
KeyPtr
&
key
,
bool
privateKey
);
bool
generateOpenSslKeys
(
const
KeyPtr
&
key
,
KeyType
type
);
bool
generateOpenSslKeys
(
const
KeyPtr
&
key
);
QString
m_error
;
QString
m_error
;
QByteArray
m_publicKey
;
QByteArray
m_publicKey
;
...
...
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