Created
November 1, 2017 17:57
-
-
Save yakivmospan/49d748b44ebf58a9c80704c7c9f7b6e8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
private fun initGeneratorWithKeyPairGeneratorSpec(generator: KeyPairGenerator, alias: String) { | |
val startDate = Calendar.getInstance() | |
val endDate = Calendar.getInstance() | |
endDate.add(Calendar.YEAR, 20) | |
val builder = KeyPairGeneratorSpec.Builder(context) | |
.setAlias(alias) | |
.setSerialNumber(BigInteger.ONE) | |
.setSubject(X500Principal("CN=${alias} CA Certificate")) | |
.setStartDate(startDate.time) | |
.setEndDate(endDate.time) | |
generator.initialize(builder.build()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment