Projects >> azure-sdk-for-java >>fd3b016f2e9fe47b0e984296e65fdb556c2ccb94

Chunk
Conflicting content
        int durationInMinutes = 10;
>>>>>>> 1a1717ef760e17af966933a84c2bb07bcefec59f

        // Act
    public void uploadAesProtectedAssetAndDownloadSuccess() throws Exception {
        // Arrange

<<<<<<< HEAD
    private String getProtectionKeyId() throws ServiceException {
        String protectionKeyId = service.action(ProtectionKey.getProtectionKeyId(ContentKeyType.StorageEncryption));
        return protectionKeyId;
    }
=======
        // Media Services requires 256-bit (32-byte) keys and
        // 128-bit (16-byte) initialization vectors (IV) for AES encryption,
        // and also requires that only the first 8 bytes of the IV is filled.
        Random random = new Random();
        byte[] aesKey = new byte[32];
        random.nextBytes(aesKey);
        byte[] effectiveIv = new byte[8];
        random.nextBytes(effectiveIv);
        byte[] iv = new byte[16];
        System.arraycopy(effectiveIv, 0, iv, 0, effectiveIv.length);

        InputStream mpeg4H264InputStream = getClass().getResourceAsStream("/media/MPEG4-H264.mp4");
        InputStream encryptedContent = EncryptionHelper.encryptFile(mpeg4H264InputStream, aesKey, iv);
        AssetInfo assetInfo = service.create(Asset.create().setName(testAssetPrefix + "uploadAesProtectedAssetSuccess")
Solution content
    public void uploadAesProtectedAssetAndDownloadSuccess() throws Exception {
        // Arrange

        // Media Services requires 256-bit (32-byte) keys and
        // 128-bit (16-byte) initialization vectors (IV) for AES encryption,
        // and also requires that only the first 8 bytes of the IV is filled.
        Random random = new Random();
        byte[] aesKey = new byte[32];
        random.nextBytes(aesKey);
        byte[] effectiveIv = new byte[8];
        random.nextBytes(effectiveIv);
        byte[] iv = new byte[16];
        System.arraycopy(effectiveIv, 0, iv, 0, effectiveIv.length);

        InputStream mpeg4H264InputStream = getClass().getResourceAsStream("/media/MPEG4-H264.mp4");
        InputStream encryptedContent = EncryptionHelper.encryptFile(mpeg4H264InputStream, aesKey, iv);
        int durationInMinutes = 10;

        // Act
        AssetInfo assetInfo = service.create(Asset.create().setName(testAssetPrefix + "uploadAesProtectedAssetSuccess")
File
EncryptionIntegrationTest.java
Developer's decision
Version 2
Kind of conflict
Comment
Method declaration
Method invocation
Variable
Chunk
Conflicting content
        return currentJobInfo;
    }

<<<<<<< HEAD
    private MediaProcessorInfo GetMediaProcessor(String mediaProcessorName) throws ServiceException {
        List mediaProcessorInfos = service.list(MediaProcessor.list());
        for (MediaProcessorInfo mediaProcessorInfo : mediaProcessorInfos) {
            if (mediaProcessorInfo.getName().equals(mediaProcessorName)) {
                return mediaProcessorInfo;
            }
        }
        return null;
    }

    private String getProtectionKey(String protectionKeyId) throws ServiceException {
        String protectionKey = service.action(ProtectionKey.getProtectionKey(protectionKeyId));
        return protectionKey;
    }
=======
    private String makeContentKeyId(byte[] aesKey) throws ServiceException, Exception {
        String protectionKeyId = (String) service.action(ProtectionKey
                .getProtectionKeyId(ContentKeyType.StorageEncryption));
        String protectionKey = (String) service.action(ProtectionKey.getProtectionKey(protectionKeyId));
>>>>>>> 1a1717ef760e17af966933a84c2bb07bcefec59f

        String contentKeyIdUuid = UUID.randomUUID().toString();
        String contentKeyId = String.format("nb:kid:UUID:%s", contentKeyIdUuid);
Solution content
        return currentJobInfo;
    }

    private String makeContentKeyId(byte[] aesKey) throws ServiceException, Exception {
        String protectionKeyId = (String) service.action(ProtectionKey
                .getProtectionKeyId(ContentKeyType.StorageEncryption));
        String protectionKey = (String) service.action(ProtectionKey.getProtectionKey(protectionKeyId));

        String contentKeyIdUuid = UUID.randomUUID().toString();
        String contentKeyId = String.format("nb:kid:UUID:%s", contentKeyIdUuid);
File
EncryptionIntegrationTest.java
Developer's decision
Version 2
Kind of conflict
Cast expression
Method declaration
Method signature
Variable