/** * Take a private key and put it into PKCS 1 format. These are used, e.g., by OpenSSL. * * @return * @throws IOException */ public static String toPKCS1PEM(PrivateKey privateKey) throws IOException { byte[] bytes = privateKey.getEncoded(); return PEMFormatUtil.delimitBody(PEMFormatUtil.bytesToChunkedString(bytes), BEGIN_RSA_PRIVATE_KEY, END_RSA_PRIVATE_KEY); }
public static String fromCertReqToString(MyPKCS10CertRequest certReq) { if (certReq == null) return null; return PEMFormatUtil.bytesToChunkedString(certReq.getEncoded()); }
public static String toX509PEM(PublicKey publicKey) { byte[] bytes = publicKey.getEncoded(); return PEMFormatUtil.delimitBody(PEMFormatUtil.bytesToChunkedString(bytes), BEGIN_PUBLIC_KEY, END_PUBLIC_KEY); }
public static String delimitBody(byte[] body, String head, String tail) { return delimitBody(bytesToChunkedString(body), head, tail); }
public static void delimitBody(byte[] body, String head, String tail, OutputStream outputStream) { delimitBody(bytesToChunkedString(body), head, tail, outputStream); }
super.preGetCert(asset, parameters); OA2Asset a = (OA2Asset) asset; parameters.put(ClientEnvironment.CERT_REQUEST_KEY, PEMFormatUtil.bytesToChunkedString(asset.getCertReq().getEncoded())); if (!parameters.containsKey(getEnvironment().getConstants().get(CALLBACK_URI_KEY))) { parameters.put(getEnvironment().getConstants().get(CALLBACK_URI_KEY), getEnvironment().getCallback().toString());