Example usage for com.liferay.portal.kernel.util Digester SHA_1

List of usage examples for com.liferay.portal.kernel.util Digester SHA_1

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util Digester SHA_1.

Prototype

String SHA_1

To view the source code for com.liferay.portal.kernel.util Digester SHA_1.

Click Source Link

Usage

From source file:com.liferay.bbb.util.BBBAPIUtil.java

License:Open Source License

protected static String getURL(BBBServer bbbServer, String methodName, String queryString)
        throws PortalException {

    StringBundler sb = new StringBundler(6);

    sb.append(bbbServer.getUrl());// w  w w.  j a v a 2 s. com
    sb.append(methodName);
    sb.append(StringPool.QUESTION);
    sb.append(queryString);
    sb.append("&checksum=");

    String checksum = DigesterUtil.digestHex(Digester.SHA_1, methodName + queryString + bbbServer.getSecret());

    sb.append(checksum);

    return sb.toString();
}

From source file:com.liferay.bbb.util.BBBUtil.java

License:Open Source License

public static String getHash(BBBParticipant bbbParticipant) throws Exception {

    BBBMeeting bbbMeeting = BBBMeetingLocalServiceUtil.getBBBMeeting(bbbParticipant.getBbbMeetingId());

    return DigesterUtil.digestHex(Digester.SHA_1, String.valueOf(bbbMeeting.getBbbMeetingId()),
            String.valueOf(bbbParticipant.getBbbParticipantId()),
            String.valueOf(bbbParticipant.getCreateDate()), bbbParticipant.getEmailAddress());
}

From source file:com.liferay.sync.util.SyncUtil.java

License:Open Source License

public static String getChecksum(DLFileVersion dlFileVersion) throws PortalException {

    if (dlFileVersion.getSize() > PortletPropsValues.SYNC_FILE_CHECKSUM_THRESHOLD_SIZE) {

        return StringPool.BLANK;
    }//from  ww w .  j a  v  a2s .c om

    return DigesterUtil.digestBase64(Digester.SHA_1, dlFileVersion.getContentStream(false));
}

From source file:com.liferay.sync.util.SyncUtil.java

License:Open Source License

public static String getChecksum(File file) throws PortalException {
    if (file.length() > PortletPropsValues.SYNC_FILE_CHECKSUM_THRESHOLD_SIZE) {

        return StringPool.BLANK;
    }/*from   w  ww .j  a  v  a2 s . c  o  m*/

    FileInputStream fileInputStream = null;

    try {
        fileInputStream = new FileInputStream(file);

        return DigesterUtil.digestBase64(Digester.SHA_1, fileInputStream);
    } catch (Exception e) {
        throw new PortalException(e);
    } finally {
        StreamUtil.cleanUp(fileInputStream);
    }
}