List of usage examples for java.security SignatureException SignatureException
public SignatureException()
From source file:org.jgrades.lic.service.LicenceManagingServiceImpl.java
@Override public Licence installLicence(String licencePath, String signaturePath) { LOGGER.debug("Starting installation of licence: {} with signature: {}", licencePath, signaturePath); Licence licence = null;//from w ww . jav a 2 s . co m try { licence = licenceDecryptionService.decrypt(keystorePath, secDataPath, licencePath); LOGGER.debug("Licence file decrypted correctly"); boolean isValid = licenceDecryptionService.validSignature(keystorePath, secDataPath, licencePath, signaturePath); if (isValid) { LOGGER.debug("Signature matches to the licence file. Saving licence in system"); LicenceEntity licenceEntity = mapper.map(licence, LicenceEntity.class); licenceEntity.setLicenceFilePath(licencePath); licenceEntity.setSignatureFilePath(signaturePath); licenceRepository.save(licenceEntity); LOGGER.debug("Licence saved in system"); } else { LOGGER.debug("Signature doesn't match to the licence file"); throw new SignatureException(); } } catch (IOException | LicenceCryptographyException | SignatureException e) { LOGGER.error("Exception during attempt to install licence: {} with signature: {}", licencePath, signaturePath, e); throw new UnreliableLicenceException(e); } return licence; }
From source file:be.fedict.commons.eid.jca.BeIDSignature.java
@Override protected byte[] engineSign() throws SignatureException { LOG.debug("engineSign"); final byte[] digestValue; String digestAlgo;//from www .j a v a2 s . c om if (null != this.messageDigest) { digestValue = this.messageDigest.digest(); digestAlgo = this.messageDigest.getAlgorithm(); if (this.signatureAlgorithm.endsWith("andMGF1")) { digestAlgo += "-PSS"; } } else if (null != this.precomputedDigestOutputStream) { digestValue = this.precomputedDigestOutputStream.toByteArray(); digestAlgo = "NONE"; } else { throw new SignatureException(); } return this.privateKey.sign(digestValue, digestAlgo); }