Class UserEventSigner
- java.lang.Object
-
- com.axis.jenkins.plugins.eiffel.eiffelbroadcaster.signing.UserEventSigner
-
- All Implemented Interfaces:
EventSigner
public class UserEventSigner extends Object implements EventSigner
Signs an event using credentials tied to aRun
. This is obviously only available during a specific build.
-
-
Constructor Summary
Constructors Constructor Description UserEventSigner(String credentialsId, HashAlgorithm hashAlgorithm, Run<?,?> run)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCredentialsId()
HashAlgorithm
getHashAlgorithm()
Run<?,?>
getRun()
boolean
sign(EiffelEvent event)
Request signing of the given event using a private key and identity.
-
-
-
Constructor Detail
-
UserEventSigner
public UserEventSigner(@NonNull String credentialsId, @NonNull HashAlgorithm hashAlgorithm, @NonNull Run<?,?> run)
-
-
Method Detail
-
getCredentialsId
public String getCredentialsId()
-
getHashAlgorithm
public HashAlgorithm getHashAlgorithm()
-
getRun
public Run<?,?> getRun()
-
sign
public boolean sign(@NonNull EiffelEvent event) throws InvalidCertificateConfigurationException, InvalidKeyException, JsonCanonicalizationException, KeyStoreException, NoSuchAlgorithmException, SignatureException, UnrecoverableKeyException, UnsupportedAlgorithmException
Request signing of the given event using a private key and identity. Based on its configuration, the implementation may choose to not sign the event.- Specified by:
sign
in interfaceEventSigner
- Parameters:
event
- theEiffelEvent
to sign in place- Returns:
- true if the event was signed, false otherwise
- Throws:
InvalidCertificateConfigurationException
- if the keystore in the certificate credential was entirely empty or its first item didn't contain a certificate with a private keyInvalidKeyException
- if the given private key was invalidJsonCanonicalizationException
- if there was an error serializing the event to canonical JSON formKeyStoreException
- if theKeyStore
hasn't been initialized (shouldn't happen and indicates a bug)NoSuchAlgorithmException
- if the algorithm needed to decrypt the key isn't availableSignatureException
- if there's a general problem in the signing processUnrecoverableKeyException
- if the key couldn't be decrypted, e.g. because the password is wrongUnsupportedAlgorithmException
- if the credential's signature algorithm isn't supported by this implementation of the Eiffel protocol or the available cryptography provider
-
-