@Test public void testEncode() throws Exception { InputStream inStream = new FileInputStream("src/test/resources CertificateFactory cf = CertificateFactory.getInstance("X.509"); final X509Certificate cert = (X509Certificate) cf.generateCertificate(inStream); assertEquals(1, new DEREncoder().encode(Collections.singletonList(cert)).length); }
@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; }
DEREncoder implements CertificateEncoder { @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; } }
DEREncoder implements CertificateEncoder { @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; }  }
DEREncoder implements CertificateEncoder { @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; }  @Override Object[] encode(final List<X509Certificate> certificates); }
DEREncoder implements CertificateEncoder { @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; }  @Override Object[] encode(final List<X509Certificate> certificates);  }