Package com.microsoft.windowsazure.services.media.models

Examples of com.microsoft.windowsazure.services.media.models.ContentKeyInfo


    @Test
    public void rebindInvalidContentKeyNoX509CertificateFail()
            throws ServiceException {
        expectedException.expect(ServiceException.class);
        expectedException.expect(new ServiceExceptionMatcher(400));
        ContentKeyInfo contentKeyInfo = createTestContentKey("rebindInvalidContentKeyNoX509Fail");

        service.action(ContentKey.rebind(contentKeyInfo.getId()));

    }
View Full Code Here


    @Test
    public void rebindContentKeyWithX509CertficateSuccess() throws Exception {
        Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
        byte[] aesKey = createTestAesKey();
        ContentKeyInfo contentKeyInfo = createValidTestContentKeyWithAesKey(
                "rebindContentKeyWithX509Success", aesKey);
        URL serverCertificateUri = getClass().getResource(
                "/certificate/server.crt");
        X509Certificate x509Certificate = EncryptionHelper
                .loadX509Certificate(URLDecoder.decode(
                        serverCertificateUri.getFile(), "UTF-8"));
        URL serverPrivateKey = getClass()
                .getResource("/certificate/server.der");
        PrivateKey privateKey = EncryptionHelper.getPrivateKey(URLDecoder
                .decode(serverPrivateKey.getFile(), "UTF-8"));

        String rebindedContentKey = service.action(ContentKey.rebind(
                contentKeyInfo.getId(), URLEncoder.encode(
                        Base64.encode(x509Certificate.getEncoded()), "UTF-8")));
        byte[] decryptedAesKey = EncryptionHelper.decryptSymmetricKey(
                rebindedContentKey, privateKey);
        assertByteArrayEquals(aesKey, decryptedAesKey);
    }
View Full Code Here

    @Test
    public void rebindContentKeyWithIncorrectX509CertificateFailed()
            throws ServiceException {
        expectedException.expect(ServiceException.class);
        ContentKeyInfo contentKeyInfo = createTestContentKey("rebindContentKeyWithIncorrectX509CertficateFailed");

        service.action(ContentKey.rebind(contentKeyInfo.getId(),
                "InvalidX509Certificate"));
    }
View Full Code Here

TOP

Related Classes of com.microsoft.windowsazure.services.media.models.ContentKeyInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.