[ENT-2821] Make the default schemes for TLS and identity available from the CryptoService interface (#4354)

* Make the default schemes for TLS and identity available from the CryptoService interface.

* Change CryptoService.generateKeyPair to accept SignatureScheme instead of Int.
This commit is contained in:
Florian Friemel
2018-12-04 17:06:12 +00:00
committed by GitHub
parent 838c99c6e4
commit 382e3b651f
5 changed files with 28 additions and 9 deletions

View File

@ -1,6 +1,7 @@
package net.corda.nodeapi.internal.cryptoservice
import net.corda.core.DoNotImplement
import net.corda.core.crypto.SignatureScheme
import org.bouncycastle.operator.ContentSigner
import java.security.KeyPair
import java.security.PublicKey
@ -16,7 +17,7 @@ interface CryptoService {
*
* Returns the [PublicKey] of the generated [KeyPair].
*/
fun generateKeyPair(alias: String, schemeNumberID: Int): PublicKey
fun generateKeyPair(alias: String, scheme: SignatureScheme): PublicKey
/** Check if this [CryptoService] has a private key entry for the input alias. */
fun containsKey(alias: String): Boolean
@ -37,6 +38,16 @@ interface CryptoService {
* Returns [ContentSigner] for the key identified by the input alias.
*/
fun getSigner(alias: String): ContentSigner
/**
* Returns the [SignatureScheme] that should be used for generating key pairs for the node's legal identity with this [CryptoService].
*/
fun defaultIdentitySignatureScheme(): SignatureScheme
/**
* Returns the [SignatureScheme] that should be used with this [CryptoService] when generating key pairs for TLS.
*/
fun defaultTLSSignatureScheme(): SignatureScheme
}
open class CryptoServiceException(message: String?, cause: Throwable? = null) : Exception(message, cause)