-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from neXenio/bugfix/028-unable-to-create-key-p…
…air-when-using-arabic Bugfix/028 unable to create key pair when using arabic
- Loading branch information
Showing
16 changed files
with
275 additions
and
24 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...st/java/com/nexenio/rxkeystore/provider/cipher/asymmetric/rsa/RsaCipherProvider2Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.nexenio.rxkeystore.provider.cipher.asymmetric.rsa; | ||
|
||
import com.nexenio.rxkeystore.RxKeyStore; | ||
import com.nexenio.rxkeystore.provider.BaseCryptoProviderTest; | ||
import com.nexenio.rxkeystore.provider.RxCryptoProvider; | ||
import com.nexenio.rxkeystore.provider.cipher.asymmetric.RxAsymmetricCipherProvider; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import java.util.Locale; | ||
|
||
import androidx.annotation.CallSuper; | ||
import androidx.annotation.NonNull; | ||
|
||
public class RsaCipherProvider2Test extends BaseCryptoProviderTest { | ||
|
||
protected RxAsymmetricCipherProvider asymmetricCryptoProvider; | ||
|
||
@Before | ||
@Override | ||
@CallSuper | ||
public void setUpBeforeEachTest() { | ||
super.setUpBeforeEachTest(); | ||
} | ||
|
||
@Override | ||
protected RxKeyStore createKeyStore() { | ||
return new RxKeyStore(RxKeyStore.TYPE_ANDROID, RxKeyStore.PROVIDER_ANDROID_KEY_STORE); | ||
} | ||
|
||
@Override | ||
protected RxCryptoProvider createCryptoProvider(@NonNull RxKeyStore keyStore) { | ||
this.asymmetricCryptoProvider = createAsymmetricCryptoProvider(keyStore); | ||
return asymmetricCryptoProvider; | ||
} | ||
|
||
protected RxAsymmetricCipherProvider createAsymmetricCryptoProvider(@NonNull RxKeyStore keyStore) { | ||
return new RsaCipherProvider(keyStore); | ||
} | ||
|
||
@Test | ||
public void generateKeyPair_arabicAsLocale_emitsKeyPair() { | ||
Locale originalLocale = Locale.getDefault(); | ||
Locale expectedLocale = new Locale("ar"); | ||
Locale.setDefault(expectedLocale); | ||
|
||
try { | ||
asymmetricCryptoProvider.generateKeyPair("alias", context) | ||
.test() | ||
.assertNoErrors(); | ||
Assert.assertEquals(Locale.getDefault(), expectedLocale); | ||
} finally { | ||
// clean up | ||
Locale.setDefault(originalLocale); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.