public static PublicKey fromX509PEM(Reader reader) throws IOException { return fromX509PEM(PEMFormatUtil.readerToString(reader)); } }
protected PublicKey checkPublicKey() throws IOException { String publicKeyFileName = getCfgValue(ClientXMLTags.PUBLIC_KEY); if (trivial(publicKeyFileName)) { throw new MyConfigurationException("Error: There is no public key specified."); } File publicKeyFile = new File(publicKeyFileName); if (!publicKeyFile.exists()) { throw new MyConfigurationException("Error: The specified public key file \"" + publicKeyFileName + "\" does not exist"); } if (!publicKeyFile.isFile()) { throw new MyConfigurationException("Error: The specified public key file \"" + publicKeyFileName + "\" is not actually a file"); } if (!publicKeyFile.canRead()) { throw new MyConfigurationException("Error: The specified public key file \"" + publicKeyFileName + "\" is not readable. Check the permissions."); } return KeyUtil.fromX509PEM(new FileReader(publicKeyFile)); }
KeyUtil.fromX509PEM(sb.toString()); askForFile = false; } catch (GeneralException gx) {
@Override protected Client addNewClient(HttpServletRequest request, HttpServletResponse response) throws Throwable { Client client = super.addNewClient(request, response); client.setSecret(getRequiredParam(request, CLIENT_PUBLIC_KEY, client)); String x = getRequiredParam(request, CLIENT_ERROR_URL, client); if(!x.toLowerCase().startsWith("https")){ throw new RetryException("The error uri \"" + x + "\" is not secure."); } client.setErrorUri(x); try { debug("decoding public key from PEM"); KeyUtil.fromX509PEM(client.getSecret()); } catch (Throwable t) { warn("could not decode public key for client=" + client.getIdentifierString() + ", message:" + t.getMessage()); request.setAttribute("client", client); throw new RetryException("public key could not be parsed. " + t.getMessage()); } fireNewClientEvent(client); return client; } }
if (oaClient.getSignatureMethod().equals(OAuthConstants.RSA_SHA1)) { PublicKey pk = fromX509PEM(oaClient.getSecret()); accessor.consumer.setProperty(OAuthConstants.PUBLIC_KEY, pk); accessor.setProperty(OAuthConstants.PUBLIC_KEY, pk);
if (oaClient.getSignatureMethod().equals(RSA_SHA1)) { PublicKey pk = fromX509PEM(oaClient.getSecret()); accessor.consumer.setProperty(OAuthConstants.PUBLIC_KEY, pk); accessor.setProperty(OAuthConstants.PUBLIC_KEY, pk);
if (oaClient.getSignatureMethod().equals(RSA_SHA1)) { PublicKey pk = fromX509PEM(oaClient.getSecret()); accessor.consumer.setProperty(OAuthConstants.PUBLIC_KEY, pk); accessor.setProperty(OAuthConstants.PUBLIC_KEY, pk);