Code example for X509Certificate

Methods: getPublicKey

0
        KeyInfo ki = new KeyInfo(doc);
 
        doc.appendChild(ki.getElement());
 
        X509Certificate cert = (X509Certificate) ks.getCertificate("kiss");
        ki.addKeyValue(cert.getPublicKey());
 
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
 
 
        XKMSUtil.outputDOM(doc, bos);
 
        XMLStreamReader reader = XMLInputFactory.newInstance()
                .createXMLStreamReader(new ByteArrayInputStream(bos.toByteArray()));
        StAXOMBuilder builder = new StAXOMBuilder(reader);
        OMElement kiEle = builder.getDocumentElement();
        kiEle.build();
 
        return kiEle;