@Override
    public Object[] encode(final List<X509Certificate> certificates) throws CertificateException {
        final Object[] encoded = new Object[certificates.size()];
        for(int i = 0; i < certificates.size(); i++) {
            encoded[i] = certificates.get(i).getEncoded();
        }
        return encoded;
    }
@Test
    public void testEncode() throws Exception {
        InputStream inStream = new FileInputStream("src/test/resources//OXxlRDVcWqdPEvFm.cer");
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        final X509Certificate cert = (X509Certificate) cf.generateCertificate(inStream);
        assertEquals(1, new DEREncoder().encode(Collections.singletonList(cert)).length);
    }