-
Notifications
You must be signed in to change notification settings - Fork 492
Provide Random
via injection and use SecureRandom
for padding (DEV)
#3676
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what this is doing, but code looks fine
The internal build pipeline raised a security warning due to our use of the default A suitable alternative is But So for the padding calculation i added a second This may be more rare on an actual device, but happens very quickly in unit-tests (especially on CIs) where the system is artificial, e.g. a VM with no good randomness source. For testing you could run the Padding Test but inject the "Strong" instance, it has a high chance of just hanging. |
Kudos, SonarCloud Quality Gate passed! |
Fixes internal sonar check.
Random
inPaddingTool
kotlin.Random
via injection to abstract away picking the right source (api level dependent)@RandomStrong
for key generation@RandomFast
for padding (asRandomStrong
can starve and block for entropy)