-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
26 additions
and
41 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -20,23 +20,25 @@ | |
import io.getlime.security.powerauth.crypto.lib.generator.KeyGenerator; | ||
import io.getlime.security.powerauth.crypto.lib.model.RecoveryInfo; | ||
import io.getlime.security.powerauth.crypto.lib.model.RecoverySeed; | ||
import io.getlime.security.powerauth.crypto.lib.model.exception.CryptoProviderException; | ||
import io.getlime.security.powerauth.crypto.lib.model.exception.GenericCryptoException; | ||
import org.bouncycastle.jce.provider.BouncyCastleProvider; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import javax.crypto.SecretKey; | ||
import java.security.*; | ||
import java.security.KeyPair; | ||
import java.security.PrivateKey; | ||
import java.security.PublicKey; | ||
import java.security.Security; | ||
import java.util.HashSet; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
/** | ||
* Test for {@link IdentifierGenerator}. | ||
* | ||
* @author Roman Strobl, [email protected] | ||
*/ | ||
public class PowerAuthRecoveryCodeTest { | ||
class IdentifierGeneratorTest { | ||
|
||
private final IdentifierGenerator identifierGenerator = new IdentifierGenerator(); | ||
|
||
|
@@ -50,7 +52,7 @@ public static void setUp() { | |
} | ||
|
||
@Test | ||
public void testRecoveryCodeDerivation() throws CryptoProviderException, InvalidKeyException, GenericCryptoException { | ||
void testRecoveryCodeDerivation() throws Exception { | ||
// Number of PUKs to test | ||
int pukCount = 100; | ||
|
||
|
@@ -89,4 +91,14 @@ public void testRecoveryCodeDerivation() throws CryptoProviderException, Invalid | |
} | ||
} | ||
|
||
@Test | ||
void testGenerateActivationCode() throws Exception { | ||
final IdentifierGenerator tested = new IdentifierGenerator(); | ||
|
||
final String result = tested.generateActivationCode(new byte[10]); | ||
|
||
// Base32 is AAAAAAAAAAAAAAAAAAAA==== | ||
assertEquals("AAAAA-AAAAA-AAAAA-AAAAA", result); | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -36,7 +36,6 @@ | |
* Test for {@link Totp}. | ||
* | ||
* @author Lubos Racansky, [email protected] | ||
* | ||
*/ | ||
class TotpTest { | ||
|
||
|
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