amv-highmobility-cryptotool-wrapper requires Java version 1.8.0_92 or greater.
./gradlew clean build
./gradlew final -Prelease.scope=patch
./gradlew clean build bintrayUpload
-Prelease.useLastTag=true
-PreleaseToBintray
-PbintrayUser=${username}
-PbintrayApiKey=${apiKey}
or (implicitly creating a new version)
./gradlew clean build bintrayUpload
-Prelease.stage=final
-Prelease.scope=patch
-PreleaseToBintray
-PbintrayUser=${username}
-PbintrayApiKey=${apiKey}
./gradlew clean build publishToMavenLocal
this library uses lombok. enable annotation processing in your ide.
./gradlew installLombok
make sure you have installed libssl.so.1.0.0. e.g. for debian (x86_64)
Cryptotool cryptotool = new CryptotoolImpl(CryptotoolOptionsImpl.createDefault());
// ...
A issuer is representing a key pair (keys
) with an optional name (name
).
When signing messages or creating device certificates with an instance of
CryptotoolWithIssuer
the public and private key params can be omitted.
CryptotoolOptions cryptotoolOptions = CryptotoolOptionsImpl.createDefault();
Cryptotool cryptotool = new CryptotoolImpl(cryptotoolOptions);
CertificateIssuer certificateIssuer = CertificateIssuerImpl.builder()
.name(TestUtils.generateRandomIssuer())
.keys(cryptotool.generateKeys().block())
.build();
Cryptotool cryptotoolWithIssuer = new CryptotoolWithIssuerImpl(cryptotoolOptions, certificateIssuer);
// ...
cryptotool.generateKeys()
.subscribe(keys -> {
log.info("public key: {}", keys.getPublicKey());
log.info("private key: {}", keys.getPublicKey());
});
String myMessage = ...
cryptotoolWithIssuer.generateSignature(myMessage)
.subscribe(signature -> {
log.info("signature: {}", signature.getSignature());
});
String myMessage = ...
String signature = ...
cryptotoolWithIssuer.verifySignature(myMessage, signature)
.subscribe(validity -> {
log.info("signature validity: {}", validity);
});
String appId = ...
String serial = ...
cryptotoolWithIssuer.createDeviceCertificate(appId, serial)
.subscribe(deviceCertificate -> {
log.info("device certificate: {}", deviceCertificate);
});
String gainingSerial = ...;
String publicKey = ...;
String providingSerial = ...;
LocalDateTime startDate = LocalDateTime.now();
LocalDateTime endDate = startDate.plusDays(1);
cryptotoolWithIssuer.createAccessCertificate(gainingSerial, publicKey, providingSerial, startDate, endDate)
.subscribe(accessCertificate -> {
log.info("access certificate: {}", accessCertificate);
});
The project is licensed under the MIT license. See LICENSE for details.