コード例 #1
0
 @Override
 public String toConfigNode(X509Certificate object, ConfigProperty property, SavingContext ctx)
     throws ConfigurationException {
   try {
     return Base64.toBase64(object.getEncoded());
   } catch (CertificateEncodingException e) {
     throw new ConfigurationException("Cannot encode X509 certificate", e);
   }
 }
コード例 #2
0
 @Override
 public X509Certificate fromConfigNode(
     String configNode, ConfigProperty property, LoadingContext ctx, Object parent)
     throws ConfigurationException {
   try {
     final byte[] base64 = Base64.fromBase64(configNode);
     return (X509Certificate)
         getX509Factory().generateCertificate(new ByteArrayInputStream(base64));
   } catch (CertificateException e) {
     throw new ConfigurationException("Cannot initialize X509 certificate converter", e);
   } catch (Exception e) {
     throw new ConfigurationException("Cannot read the X509 certificate", e);
   }
 }