Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring SCEP Certificate provider to support multiple SAN's
- Loading branch information
Showing
5 changed files
with
130 additions
and
30 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
28 changes: 20 additions & 8 deletions
28
blended.security.scep/src/test/scala/blended/security/scep/internal/ScepTestClient.scala
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
37 changes: 37 additions & 0 deletions
37
blended.security.scep/src/test/scala/blended/security/scep/internal/SelfSignedTest.scala
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,37 @@ | ||
package blended.security.scep.internal | ||
|
||
import java.io.File | ||
|
||
import blended.security.ssl._ | ||
import blended.security.ssl.internal.{JavaKeystore, MemoryKeystore} | ||
|
||
import scala.util.Try | ||
|
||
object SelfSignedTest { | ||
|
||
private val selfSignedCfg : SelfSignedConfig = SelfSignedConfig( | ||
commonNameProvider = new CommonNameProvider { | ||
override def commonName(): Try[String] = Try { "CN=cachea.9999.cc.kaufland, O=Schwarz IT GmbH & Co. KG, C=CC" } | ||
//override def commonName(): Try[String] = Try { "CN=cc9999lnxprx01.9999.cc.kaufland, O=Schwarz IT GmbH & Co. KG, C=CC" } | ||
override def alternativeNames(): Try[List[String]] = Try { List("cc9999lnxprx01.9999.cc.kaufland", "cachea.9999.cc.kaufland") } | ||
}, | ||
keyStrength = 2048, | ||
sigAlg = "SHA256withRSA", | ||
validDays = 1 | ||
) | ||
|
||
private val provider : CertificateProvider = new SelfSignedCertificateProvider(selfSignedCfg) | ||
|
||
def main(args: Array[String]) : Unit = { | ||
|
||
val keystore = new JavaKeystore(new File("/tmp/keystore"), "test".toCharArray, Some("test".toCharArray)) | ||
val memStore = new MemoryKeystore(Map.empty) | ||
|
||
val cert : CertificateHolder = provider.refreshCertificate(None, selfSignedCfg.commonNameProvider).get.copy(changed = true) | ||
println(cert.dump) | ||
|
||
keystore.saveKeyStore(memStore.update("cert", cert).get) | ||
|
||
} | ||
|
||
} |
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