Search in sources :

Example 1 with CMSTimeStampedData

use of org.bouncycastle.tsp.cms.CMSTimeStampedData in project tika by apache.

the class TSDParser method extractMetas.

private List<TSDMetas> extractMetas(InputStream stream) {
    List<TSDMetas> tsdMetasList = new ArrayList<>();
    try {
        CMSTimeStampedData cmsTimeStampedData = new CMSTimeStampedData(stream);
        TimeStampToken[] tokens = cmsTimeStampedData.getTimeStampTokens();
        for (int i = 0; i < tokens.length; i++) {
            TSDMetas tsdMetas = new TSDMetas(true, tokens[i].getTimeStampInfo().getGenTime(), tokens[i].getTimeStampInfo().getPolicy().getId(), tokens[i].getTimeStampInfo().getSerialNumber(), tokens[i].getTimeStampInfo().getTsa(), tokens[i].getTimeStampInfo().getHashAlgorithm().getAlgorithm().getId());
            tsdMetasList.add(tsdMetas);
        }
    } catch (Exception ex) {
        LOG.error("Error in TSDParser.buildMetas {}", ex.getMessage());
        tsdMetasList.clear();
    }
    return tsdMetasList;
}
Also used : CMSTimeStampedData(org.bouncycastle.tsp.cms.CMSTimeStampedData) ArrayList(java.util.ArrayList) TimeStampToken(org.bouncycastle.tsp.TimeStampToken) TikaException(org.apache.tika.exception.TikaException) IOException(java.io.IOException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) SAXException(org.xml.sax.SAXException) NoSuchProviderException(java.security.NoSuchProviderException)

Aggregations

IOException (java.io.IOException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 NoSuchProviderException (java.security.NoSuchProviderException)1 ArrayList (java.util.ArrayList)1 TikaException (org.apache.tika.exception.TikaException)1 TimeStampToken (org.bouncycastle.tsp.TimeStampToken)1 CMSTimeStampedData (org.bouncycastle.tsp.cms.CMSTimeStampedData)1 SAXException (org.xml.sax.SAXException)1