public static FileKey toSwaggerFileKey(final EncryptedFileKey k) {
        return new FileKey().key(byteArrayToBase64String(k.getKey())).iv(byteArrayToBase64String(k.getIv())).tag(byteArrayToBase64String(k.getTag())).version(k.getVersion().getValue());
    }
@Test
    public void testFileKey() throws Exception {
        final JSON json = new JSON();
        final FileKey fileKey = TripleCryptConverter.toSwaggerFileKey(Crypto.generateFileKey(PlainFileKey.Version.AES256GCM));
        assertNotNull(fileKey.getIv());
        assertNotNull(fileKey.getKey());
        assertNull(fileKey.getTag());
        assertNotNull(fileKey.getVersion());
        final ObjectWriter writer = json.getContext(null).writerFor(FileKey.class);
        final ByteArrayOutputStream out = new ByteArrayOutputStream();
        writer.writeValue(out, fileKey);
        final ByteBuffer buffer = ByteBuffer.wrap(out.toByteArray());
        final ObjectReader reader = json.getContext(null).readerFor(FileKey.class);
        assertEquals(fileKey, reader.readValue(buffer.array()));
    }