/** * Initialize SWF verification data. * * @param swfFilePath path to the swf file or null */ public void initSwfVerification(String swfFilePath) { log.info("Initializing swf verification for: {}", swfFilePath); byte[] bytes = null; if (swfFilePath != null) { File localSwfFile = new File(swfFilePath); if (localSwfFile.exists() && localSwfFile.canRead()) { log.info("Swf file path: {}", localSwfFile.getAbsolutePath()); bytes = FileUtil.readAsByteArray(localSwfFile); } else { bytes = "Red5 is awesome for handling non-accessable swf file".getBytes(); } } else { bytes = new byte[42]; } calculateHMAC_SHA256(bytes, 0, bytes.length, GENUINE_FP_KEY, 30, swfHash, 0); swfSize = bytes.length; log.info("Verification - size: {}, hash: {}", swfSize, Hex.encodeHexString(swfHash)); }