Java Code Examples for org.bouncycastle.tsp.TSPException#getMessage()

The following examples show how to use org.bouncycastle.tsp.TSPException#getMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TimestampUtil.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public static TimeStampResponse getTimestampResponse(byte[] tsTokenResponse) throws TechnicalConnectorException {
   try {
      byte[] clonetsTokenResponse = ArrayUtils.clone(tsTokenResponse);
      clonetsTokenResponse = ConnectorIOUtils.base64Decode(clonetsTokenResponse, true);
      TimeStampResponse tsResp = new TimeStampResponse(clonetsTokenResponse);
      if (tsResp.getTimeStampToken() == null) {
         throw new TSPException("no response for the RFC3161 token");
      } else {
         return tsResp;
      }
   } catch (TSPException var3) {
      LOG.error(var3.getClass().getSimpleName() + ": " + var3.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var3, new Object[]{var3.getMessage()});
   } catch (IOException var4) {
      LOG.error(var4.getClass().getSimpleName() + ": " + var4.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var4, new Object[]{var4.getMessage()});
   }
}
 
Example 2
Source File: TimestampUtil.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public static TimeStampToken getTimeStampToken(byte[] tsToken) throws TechnicalConnectorException {
   byte[] cloneTsToken = ArrayUtils.clone(tsToken);

   try {
      cloneTsToken = ConnectorIOUtils.base64Decode(cloneTsToken, true);
      return new TimeStampToken(new CMSSignedData(cloneTsToken));
   } catch (TSPException var3) {
      LOG.error(var3.getClass().getSimpleName() + ": " + var3.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var3, new Object[]{var3.getMessage()});
   } catch (IOException var4) {
      LOG.error(var4.getClass().getSimpleName() + ": " + var4.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var4, new Object[]{var4.getMessage()});
   } catch (CMSException var5) {
      LOG.error(var5.getClass().getSimpleName() + ": " + var5.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var5, new Object[]{var5.getMessage()});
   }
}
 
Example 3
Source File: TimestampUtil.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public static TimeStampResponse getTimestampResponse(byte[] tsTokenResponse) throws TechnicalConnectorException {
   try {
      byte[] clonetsTokenResponse = ArrayUtils.clone(tsTokenResponse);
      clonetsTokenResponse = ConnectorIOUtils.base64Decode(clonetsTokenResponse, true);
      TimeStampResponse tsResp = new TimeStampResponse(clonetsTokenResponse);
      if (tsResp.getTimeStampToken() == null) {
         throw new TSPException("no response for the RFC3161 token");
      } else {
         return tsResp;
      }
   } catch (TSPException var3) {
      LOG.error(var3.getClass().getSimpleName() + ": " + var3.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var3, new Object[]{var3.getMessage()});
   } catch (IOException var4) {
      LOG.error(var4.getClass().getSimpleName() + ": " + var4.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var4, new Object[]{var4.getMessage()});
   }
}
 
Example 4
Source File: TimestampUtil.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public static TimeStampToken getTimeStampToken(byte[] tsToken) throws TechnicalConnectorException {
   byte[] cloneTsToken = ArrayUtils.clone(tsToken);

   try {
      cloneTsToken = ConnectorIOUtils.base64Decode(cloneTsToken, true);
      return new TimeStampToken(new CMSSignedData(cloneTsToken));
   } catch (TSPException var3) {
      LOG.error(var3.getClass().getSimpleName() + ": " + var3.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var3, new Object[]{var3.getMessage()});
   } catch (IOException var4) {
      LOG.error(var4.getClass().getSimpleName() + ": " + var4.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var4, new Object[]{var4.getMessage()});
   } catch (CMSException var5) {
      LOG.error(var5.getClass().getSimpleName() + ": " + var5.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var5, new Object[]{var5.getMessage()});
   }
}
 
Example 5
Source File: TimestampUtil.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public static TimeStampResponse getTimestampResponse(byte[] tsTokenResponse) throws TechnicalConnectorException {
   try {
      byte[] clonetsTokenResponse = ArrayUtils.clone(tsTokenResponse);
      clonetsTokenResponse = ConnectorIOUtils.base64Decode(clonetsTokenResponse, true);
      TimeStampResponse tsResp = new TimeStampResponse(clonetsTokenResponse);
      if (tsResp.getTimeStampToken() == null) {
         throw new TSPException("no response for the RFC3161 token");
      } else {
         return tsResp;
      }
   } catch (TSPException var3) {
      LOG.error(var3.getClass().getSimpleName() + ": " + var3.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var3, new Object[]{var3.getMessage()});
   } catch (IOException var4) {
      LOG.error(var4.getClass().getSimpleName() + ": " + var4.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var4, new Object[]{var4.getMessage()});
   }
}
 
Example 6
Source File: TimestampUtil.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public static TimeStampToken getTimeStampToken(byte[] tsToken) throws TechnicalConnectorException {
   byte[] cloneTsToken = ArrayUtils.clone(tsToken);

   try {
      cloneTsToken = ConnectorIOUtils.base64Decode(cloneTsToken, true);
      return new TimeStampToken(new CMSSignedData(cloneTsToken));
   } catch (TSPException var3) {
      LOG.error(var3.getClass().getSimpleName() + ": " + var3.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var3, new Object[]{var3.getMessage()});
   } catch (IOException var4) {
      LOG.error(var4.getClass().getSimpleName() + ": " + var4.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var4, new Object[]{var4.getMessage()});
   } catch (CMSException var5) {
      LOG.error(var5.getClass().getSimpleName() + ": " + var5.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var5, new Object[]{var5.getMessage()});
   }
}
 
Example 7
Source File: TimestampUtil.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public static TimeStampResponse getTimestampResponse(byte[] tsTokenResponse) throws TechnicalConnectorException {
   try {
      byte[] clonetsTokenResponse = ArrayUtils.clone(tsTokenResponse);
      clonetsTokenResponse = ConnectorIOUtils.base64Decode(clonetsTokenResponse, true);
      TimeStampResponse tsResp = new TimeStampResponse(clonetsTokenResponse);
      if (tsResp.getTimeStampToken() == null) {
         throw new TSPException("no response for the RFC3161 token");
      } else {
         return tsResp;
      }
   } catch (TSPException var3) {
      LOG.error(var3.getClass().getSimpleName() + ": " + var3.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var3, new Object[]{var3.getMessage()});
   } catch (IOException var4) {
      LOG.error(var4.getClass().getSimpleName() + ": " + var4.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var4, new Object[]{var4.getMessage()});
   }
}
 
Example 8
Source File: TimestampUtil.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public static TimeStampToken getTimeStampToken(byte[] tsToken) throws TechnicalConnectorException {
   byte[] cloneTsToken = ArrayUtils.clone(tsToken);

   try {
      cloneTsToken = ConnectorIOUtils.base64Decode(cloneTsToken, true);
      return new TimeStampToken(new CMSSignedData(cloneTsToken));
   } catch (TSPException var3) {
      LOG.error(var3.getClass().getSimpleName() + ": " + var3.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var3, new Object[]{var3.getMessage()});
   } catch (IOException var4) {
      LOG.error(var4.getClass().getSimpleName() + ": " + var4.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var4, new Object[]{var4.getMessage()});
   } catch (CMSException var5) {
      LOG.error(var5.getClass().getSimpleName() + ": " + var5.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var5, new Object[]{var5.getMessage()});
   }
}
 
Example 9
Source File: TimestampUtil.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public static TimeStampResponse getTimestampResponse(byte[] tsTokenResponse) throws TechnicalConnectorException {
   try {
      byte[] clonetsTokenResponse = ArrayUtils.clone(tsTokenResponse);
      clonetsTokenResponse = ConnectorIOUtils.base64Decode(clonetsTokenResponse, true);
      TimeStampResponse tsResp = new TimeStampResponse(clonetsTokenResponse);
      if (tsResp.getTimeStampToken() == null) {
         throw new TSPException("no response for the RFC3161 token");
      } else {
         return tsResp;
      }
   } catch (TSPException var3) {
      LOG.error(var3.getClass().getSimpleName() + ": " + var3.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var3, new Object[]{var3.getMessage()});
   } catch (IOException var4) {
      LOG.error(var4.getClass().getSimpleName() + ": " + var4.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var4, new Object[]{var4.getMessage()});
   }
}
 
Example 10
Source File: TimestampUtil.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public static TimeStampToken getTimeStampToken(byte[] tsToken) throws TechnicalConnectorException {
   byte[] cloneTsToken = ArrayUtils.clone(tsToken);

   try {
      cloneTsToken = ConnectorIOUtils.base64Decode(cloneTsToken, true);
      return new TimeStampToken(new CMSSignedData(cloneTsToken));
   } catch (TSPException var3) {
      LOG.error(var3.getClass().getSimpleName() + ": " + var3.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var3, new Object[]{var3.getMessage()});
   } catch (IOException var4) {
      LOG.error(var4.getClass().getSimpleName() + ": " + var4.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var4, new Object[]{var4.getMessage()});
   } catch (CMSException var5) {
      LOG.error(var5.getClass().getSimpleName() + ": " + var5.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var5, new Object[]{var5.getMessage()});
   }
}
 
Example 11
Source File: ResponseBuilderImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private void validateTimeStamp(TimeStampRequest tsRequest, TimeStampResponse timeStampResponse) throws UnsealConnectorException, ChapterIVBusinessConnectorException {
   try {
      LOG.trace("validating timestamp response");
      timeStampResponse.validate(tsRequest);
      LOG.trace(" timestamp response validated , now validating timestamp token");
      this.validateTimeStampToken(timeStampResponse);
      LOG.trace(" timestamp token validated");
   } catch (TSPException var4) {
      throw new UnsealConnectorException(UnsealConnectorExceptionValues.ERROR_CRYPTO, var4, new Object[]{"time stamp was not valid :" + var4.getMessage()});
   } catch (TechnicalConnectorException var5) {
      throw new UnsealConnectorException(UnsealConnectorExceptionValues.ERROR_CRYPTO, var5, new Object[]{" error while validating timestamptoken :" + var5.getMessage()});
   }
}
 
Example 12
Source File: ResponseBuilderImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private void validateTimeStamp(TimeStampRequest tsRequest, TimeStampResponse timeStampResponse) throws UnsealConnectorException, ChapterIVBusinessConnectorException {
   try {
      LOG.trace("validating timestamp response");
      timeStampResponse.validate(tsRequest);
      LOG.trace(" timestamp response validated , now validating timestamp token");
      this.validateTimeStampToken(timeStampResponse);
      LOG.trace(" timestamp token validated");
   } catch (TSPException var4) {
      throw new UnsealConnectorException(UnsealConnectorExceptionValues.ERROR_CRYPTO, var4, new Object[]{"time stamp was not valid :" + var4.getMessage()});
   } catch (TechnicalConnectorException var5) {
      throw new UnsealConnectorException(UnsealConnectorExceptionValues.ERROR_CRYPTO, var5, new Object[]{" error while validating timestamptoken :" + var5.getMessage()});
   }
}
 
Example 13
Source File: ResponseBuilderImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private void validateTimeStamp(TimeStampRequest tsRequest, TimeStampResponse timeStampResponse) throws UnsealConnectorException, ChapterIVBusinessConnectorException {
   try {
      LOG.trace("validating timestamp response");
      timeStampResponse.validate(tsRequest);
      LOG.trace(" timestamp response validated , now validating timestamp token");
      this.validateTimeStampToken(timeStampResponse);
      LOG.trace(" timestamp token validated");
   } catch (TSPException var4) {
      throw new UnsealConnectorException(UnsealConnectorExceptionValues.ERROR_CRYPTO, var4, new Object[]{"time stamp was not valid :" + var4.getMessage()});
   } catch (TechnicalConnectorException var5) {
      throw new UnsealConnectorException(UnsealConnectorExceptionValues.ERROR_CRYPTO, var5, new Object[]{" error while validating timestamptoken :" + var5.getMessage()});
   }
}
 
Example 14
Source File: ResponseBuilderImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private void validateTimeStamp(TimeStampRequest tsRequest, TimeStampResponse timeStampResponse) throws UnsealConnectorException, ChapterIVBusinessConnectorException {
   try {
      LOG.trace("validating timestamp response");
      timeStampResponse.validate(tsRequest);
      LOG.trace(" timestamp response validated , now validating timestamp token");
      this.validateTimeStampToken(timeStampResponse);
      LOG.trace(" timestamp token validated");
   } catch (TSPException var4) {
      throw new UnsealConnectorException(UnsealConnectorExceptionValues.ERROR_CRYPTO, var4, new Object[]{"time stamp was not valid :" + var4.getMessage()});
   } catch (TechnicalConnectorException var5) {
      throw new UnsealConnectorException(UnsealConnectorExceptionValues.ERROR_CRYPTO, var5, new Object[]{" error while validating timestamptoken :" + var5.getMessage()});
   }
}
 
Example 15
Source File: TimestampToken.java    From dss with GNU Lesser General Public License v2.1 5 votes vote down vote up
private boolean isValidTimestamp(SignerInformationVerifier signerInformationVerifier) {
	try {
		// Validate the timestamp, the signing certificate,...
		timeStamp.validate(signerInformationVerifier);
		return true;
	} catch (TSPException e) {
		if (LOG.isDebugEnabled()) {
			LOG.debug("Unable to validate timestamp token : ", e);
		} else {
			LOG.warn("Unable to validate timestamp token : {}", e.getMessage());
		}
		signatureInvalidityReason = e.getClass().getSimpleName() + " : " + e.getMessage();
		return false;
	}
}