https://github.com/anicolaspp/skeystore
A small Java Key Store Wrapper in Scala
https://github.com/anicolaspp/skeystore
keystore scala security
Last synced: 8 days ago
JSON representation
A small Java Key Store Wrapper in Scala
- Host: GitHub
- URL: https://github.com/anicolaspp/skeystore
- Owner: anicolaspp
- License: mit
- Created: 2019-01-15T13:35:55.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-15T16:21:57.000Z (over 7 years ago)
- Last Synced: 2025-03-06T03:14:46.605Z (about 1 year ago)
- Topics: keystore, scala, security
- Language: Scala
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# skeystore
A small Java Key Store Wrapper in Scala
They Key Store Wrapper supports adding aliases to a `JCEKS` keystore.
We can create a keystore using the following command.
```
keytool -keystore keystore -genkey -alias nico -storetype jceks
```
Notice that not all types of keystores will support the required functionality.
The following test shows how our library is used.
```
object SecureStoreTest extends Properties("KeyStore") {
private val path = getClass.getResource("/keystore").getPath
private val storePassword = "randompass"
private val entries = Gen.alphaStr
property("read and write entry") = forAll(entries, entries) { (alias: String, pwd: String) =>
val store = SecureStore.fromFile(path, storePassword)
(alias.length > 0 && pwd.length > 0) ==> {
store.addEntry(alias, pwd)
store.readPasswordForEntry(alias, storePassword) == pwd
}
}
}
```
`private val storePassword = "randompass"` is the keystore password we used when creating the keystore. Since this test is
written using `ScalaCheck`, it will actually run `100` iterations with different combinations of `alias` and `pwd` and it
makes sure we can successfully read and write from the keystore.
## Cross Building
Use the following command to build.
```
sbt +assembly
```
This command build against `scala 2.11.8` so it can be used on `Apache Spark` and `scala 2.12.8`. It will generate 2 `.jar`
outputs, one for each version.