Examples of ByteArrayRandomAccessBuffer


Examples of freenet.support.io.ByteArrayRandomAccessBuffer

    }
   
    @Test
    public void testWrongMasterSecret() throws IOException, GeneralSecurityException{
        byte[] bytes = new byte[100];
        ByteArrayRandomAccessBuffer barat = new ByteArrayRandomAccessBuffer(bytes);
        EncryptedRandomAccessBuffer erat = new EncryptedRandomAccessBuffer(types[0], barat, secret, true);
        erat.close();
        ByteArrayRandomAccessBuffer barat2 = new ByteArrayRandomAccessBuffer(bytes);
        thrown.expect(GeneralSecurityException.class);
        thrown.expectMessage("MAC is incorrect");
        EncryptedRandomAccessBuffer erat2 = new EncryptedRandomAccessBuffer(types[0], barat2,
                new MasterSecret(), false);
    }
View Full Code Here

Examples of freenet.support.io.ByteArrayRandomAccessBuffer

   
    @Test (expected = NullPointerException.class)
    public void testEncryptedRandomAccessThingNullInput1()
            throws GeneralSecurityException, IOException {
        byte[] bytes = new byte[10];
        ByteArrayRandomAccessBuffer barat = new ByteArrayRandomAccessBuffer(bytes);
        EncryptedRandomAccessBuffer erat = new EncryptedRandomAccessBuffer(null, barat, secret, true);
    }
View Full Code Here

Examples of freenet.support.io.ByteArrayRandomAccessBuffer

    }
   
    @Test (expected = NullPointerException.class)
    public void testEncryptedRandomAccessThingNullByteArray()
            throws GeneralSecurityException, IOException {
        ByteArrayRandomAccessBuffer barat = new ByteArrayRandomAccessBuffer(null);
        EncryptedRandomAccessBuffer erat = new EncryptedRandomAccessBuffer(types[0], barat, secret, true);
    }
View Full Code Here

Examples of freenet.support.io.ByteArrayRandomAccessBuffer

    }
   
    @Test (expected = NullPointerException.class)
    public void testEncryptedRandomAccessThingNullBARAT()
            throws GeneralSecurityException, IOException {
        ByteArrayRandomAccessBuffer barat = null;
        EncryptedRandomAccessBuffer erat = new EncryptedRandomAccessBuffer(types[0], barat, secret, true);
    }
View Full Code Here

Examples of freenet.support.io.ByteArrayRandomAccessBuffer

   
    @Test (expected = NullPointerException.class)
    public void testEncryptedRandomAccessThingNullInput3()
            throws GeneralSecurityException, IOException {
        byte[] bytes = new byte[10];
        ByteArrayRandomAccessBuffer barat = new ByteArrayRandomAccessBuffer(bytes);
        EncryptedRandomAccessBuffer erat = new EncryptedRandomAccessBuffer(types[0], barat, null, true);
    }
View Full Code Here

Examples of freenet.support.io.ByteArrayRandomAccessBuffer

    }

    @Test
    public void testSize() throws IOException, GeneralSecurityException {
        byte[] bytes = new byte[100];
        ByteArrayRandomAccessBuffer barat = new ByteArrayRandomAccessBuffer(bytes);
        EncryptedRandomAccessBuffer erat = new EncryptedRandomAccessBuffer(types[0], barat, secret, true);
        assertEquals(erat.size(), barat.size()-types[0].headerLen);
    }
View Full Code Here

Examples of freenet.support.io.ByteArrayRandomAccessBuffer

    }

    @Test
    public void testPreadFileOffsetTooSmall() throws IOException, GeneralSecurityException {
        byte[] bytes = new byte[100];
        ByteArrayRandomAccessBuffer barat = new ByteArrayRandomAccessBuffer(bytes);
        EncryptedRandomAccessBuffer erat = new EncryptedRandomAccessBuffer(types[0], barat, secret, true);
        byte[] result = new byte[20];
        thrown.expect(IllegalArgumentException.class);
        thrown.expectMessage("Cannot read before zero");
        erat.pread(-1, result, 0, 20);
View Full Code Here

Examples of freenet.support.io.ByteArrayRandomAccessBuffer

    }
   
    @Test
    public void testPreadFileOffsetTooBig() throws IOException, GeneralSecurityException {
        byte[] bytes = new byte[100];
        ByteArrayRandomAccessBuffer barat = new ByteArrayRandomAccessBuffer(bytes);
        EncryptedRandomAccessBuffer erat = new EncryptedRandomAccessBuffer(types[0], barat, secret, true);
        int len = 20;
        byte[] result = new byte[len];
        int offset = 100;
        thrown.expect(IOException.class);
View Full Code Here

Examples of freenet.support.io.ByteArrayRandomAccessBuffer

    }
   
    @Test
    public void testPwriteFileOffsetTooSmall() throws IOException, GeneralSecurityException {
        byte[] bytes = new byte[100];
        ByteArrayRandomAccessBuffer barat = new ByteArrayRandomAccessBuffer(bytes);
        EncryptedRandomAccessBuffer erat = new EncryptedRandomAccessBuffer(types[0], barat, secret, true);
        byte[] result = new byte[20];
        thrown.expect(IllegalArgumentException.class);
        thrown.expectMessage("Cannot read before zero");
        erat.pwrite(-1, result, 0, 20);
View Full Code Here

Examples of freenet.support.io.ByteArrayRandomAccessBuffer

    }
   
    @Test
    public void testPwriteFileOffsetTooBig() throws IOException, GeneralSecurityException {
        byte[] bytes = new byte[100];
        ByteArrayRandomAccessBuffer barat = new ByteArrayRandomAccessBuffer(bytes);
        EncryptedRandomAccessBuffer erat = new EncryptedRandomAccessBuffer(types[0], barat, secret, true);
        int len = 20;
        byte[] result = new byte[len];
        int offset = 100;
        thrown.expect(IOException.class);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.