Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Olm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
Nheko Reborn
Olm
Commits
570e8bbe
Commit
570e8bbe
authored
8 years ago
by
ylecollen
Browse files
Options
Downloads
Patches
Plain Diff
use secureRandom in getRandomKey
parent
ce9f67d5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmUtility.java
+5
-11
5 additions, 11 deletions
...bSdk/olm-sdk/src/main/java/org/matrix/olm/OlmUtility.java
with
5 additions
and
11 deletions
java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmUtility.java
+
5
−
11
View file @
570e8bbe
...
...
@@ -20,7 +20,7 @@ package org.matrix.olm;
import
android.text.TextUtils
;
import
android.util.Log
;
import
java.
util.
Random
;
import
java.
security.Secure
Random
;
/**
* Olm SDK helper class.
...
...
@@ -138,16 +138,10 @@ public class OlmUtility {
* @return string containing randoms integer values
*/
public
static
String
getRandomKey
()
{
String
keyRetValue
;
Random
rand
=
new
Random
();
StringBuilder
strBuilder
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
RANDOM_KEY_SIZE
;
i
++)
{
strBuilder
.
append
(
rand
.
nextInt
(
RANDOM_RANGE
));
}
keyRetValue
=
strBuilder
.
toString
();
return
keyRetValue
;
SecureRandom
secureRandom
=
new
SecureRandom
();
byte
[]
buffer
=
new
byte
[
RANDOM_KEY_SIZE
];
secureRandom
.
nextBytes
(
buffer
);
return
new
String
(
buffer
);
}
/**
...
...
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