List of usage examples for javax.security.jacc PolicyContextException getMessage
public String getMessage()
From source file:test.be.fedict.eid.applet.InsecureClientEnvironmentWarningServiceImpl.java
public void checkSecureClientEnvironment(String javaVersion, String javaVendor, String osName, String osArch, String osVersion, String userAgent, String navigatorAppName, String navigatorAppVersion, String navigatorUserAgent, String remoteAddress, Integer sslKeySize, String sslCipherSuite, List<String> readerList) throws InsecureClientEnvironmentException { LOG.debug("insecure warning"); LOG.debug("java version: " + javaVersion); LOG.debug("java vendor: " + javaVendor); LOG.debug("OS name: " + osName); LOG.debug("OS arch: " + osArch); LOG.debug("OS version: " + osVersion); LOG.debug("user agent: " + userAgent); LOG.debug("navigator app name: " + navigatorAppName); LOG.debug("navigator app version: " + navigatorAppVersion); LOG.debug("navigator user agent: " + navigatorUserAgent); LOG.debug("remote address: " + remoteAddress); LOG.debug("ssl key size: " + sslKeySize); LOG.debug("ssl cipher suite: " + sslCipherSuite); LOG.debug("readers: " + readerList); HttpServletRequest httpServletRequest; try {/* w w w .j ava 2s.c om*/ httpServletRequest = (HttpServletRequest) PolicyContext .getContext("javax.servlet.http.HttpServletRequest"); } catch (PolicyContextException e) { throw new RuntimeException("JACC error: " + e.getMessage()); } HttpSession httpSession = httpServletRequest.getSession(); httpSession.setAttribute("ClientJavaVersion", javaVersion); httpSession.setAttribute("ClientJavaVendor", javaVendor); httpSession.setAttribute("ClientOSName", osName); httpSession.setAttribute("ClientOSArch", osArch); httpSession.setAttribute("ClientOSVersion", osVersion); httpSession.setAttribute("ClientReaders", readerList.toString()); httpSession.setAttribute("ClientUserAgent", userAgent); httpSession.setAttribute("ClientSslCipherSuite", sslCipherSuite); httpSession.setAttribute("ClientRemoteAddress", remoteAddress); httpSession.setAttribute("ClientSslKeySize", sslKeySize); httpSession.setAttribute("ClientNavigatorUserAgent", navigatorUserAgent); httpSession.setAttribute("ClientNavigatorAppName", navigatorAppName); httpSession.setAttribute("ClientNavigatorAppVersion", navigatorAppVersion); throw new InsecureClientEnvironmentException(true); }
From source file:test.be.fedict.eid.applet.model.AuthenticationServiceBean.java
public void validateCertificateChain(List<X509Certificate> certificateChain) throws SecurityException { LOG.debug("validate certificate chain: " + certificateChain); HttpServletRequest httpServletRequest; try {//from w w w .ja v a2s. c o m httpServletRequest = (HttpServletRequest) PolicyContext .getContext("javax.servlet.http.HttpServletRequest"); } catch (PolicyContextException e) { throw new RuntimeException("JACC error: " + e.getMessage()); } HttpSession httpSession = httpServletRequest.getSession(); httpSession.setAttribute("AuthenticationCertificateChain", certificateChain); }
From source file:test.be.fedict.eid.applet.model.ChannelBindingServiceBean.java
public X509Certificate getServerCertificate() { LOG.debug("getServerCertificate"); HttpServletRequest httpServletRequest; try {/*from w ww .j a v a2 s . c om*/ httpServletRequest = (HttpServletRequest) PolicyContext .getContext("javax.servlet.http.HttpServletRequest"); } catch (PolicyContextException e) { throw new RuntimeException("JACC error: " + e.getMessage()); } HttpSession httpSession = httpServletRequest.getSession(); X509Certificate serverCertificate = (X509Certificate) httpSession .getAttribute(SERVER_CERTIFICATE_SESSION_ATTRIBUTE); return serverCertificate; }
From source file:test.be.fedict.eid.applet.model.FilesSignatureServiceBean.java
public void postSign(byte[] signatureValue, List<X509Certificate> signingCertificateChain) { LOG.debug("postSign"); HttpServletRequest httpServletRequest; try {/*from w w w. j ava 2 s . co m*/ httpServletRequest = (HttpServletRequest) PolicyContext .getContext("javax.servlet.http.HttpServletRequest"); } catch (PolicyContextException e) { throw new RuntimeException("JACC error: " + e.getMessage()); } String signatureValueStr = new String(Hex.encodeHex(signatureValue)); HttpSession session = httpServletRequest.getSession(); session.setAttribute("SignatureValue", signatureValueStr); session.setAttribute("SigningCertificateChain", signingCertificateChain); }
From source file:test.be.fedict.eid.applet.model.FilesSignatureServiceBean.java
public DigestInfo preSign(List<DigestInfo> digestInfos, List<X509Certificate> signingCertificateChain) throws NoSuchAlgorithmException { LOG.debug("preSign"); HttpServletRequest httpServletRequest; try {/*ww w .ja v a 2 s .c o m*/ httpServletRequest = (HttpServletRequest) PolicyContext .getContext("javax.servlet.http.HttpServletRequest"); } catch (PolicyContextException e) { throw new RuntimeException("JACC error: " + e.getMessage()); } HttpSession session = httpServletRequest.getSession(); String signDigestAlgo = (String) session.getAttribute("signDigestAlgo"); LOG.debug("signature digest algo: " + signDigestAlgo); List<String> fileDescriptions = new LinkedList<String>(); MessageDigest messageDigest = MessageDigest.getInstance(signDigestAlgo, new BouncyCastleProvider()); for (DigestInfo digestInfo : digestInfos) { LOG.debug("processing digest for: " + digestInfo.description); fileDescriptions.add(digestInfo.description + "\n"); messageDigest.update(digestInfo.digestValue); /* * XMLDSig, XAdES or PDF is possible here... */ } byte[] digestValue = messageDigest.digest(); session.setAttribute("signedFiles", fileDescriptions); String description = "Local Test Files"; return new DigestInfo(digestValue, signDigestAlgo, description); }
From source file:test.be.fedict.eid.applet.model.FilesSignatureServiceBean.java
public String getFilesDigestAlgorithm() { LOG.debug("getFileDigestAlgoritm()"); HttpServletRequest httpServletRequest; try {/*from w ww . j a v a 2 s . c om*/ httpServletRequest = (HttpServletRequest) PolicyContext .getContext("javax.servlet.http.HttpServletRequest"); } catch (PolicyContextException e) { throw new RuntimeException("JACC error: " + e.getMessage()); } HttpSession session = httpServletRequest.getSession(); String filesDigestAlgo = (String) session.getAttribute("filesDigestAlgo"); LOG.debug("files digest algo: " + filesDigestAlgo); return filesDigestAlgo; }
From source file:test.be.fedict.eid.applet.model.IdentityIntegrityServiceBean.java
public void checkNationalRegistrationCertificate(List<X509Certificate> certificateChain) throws SecurityException { LOG.debug("checking national registry certificate..."); HttpServletRequest httpServletRequest; try {//from ww w . j av a2s . co m httpServletRequest = (HttpServletRequest) PolicyContext .getContext("javax.servlet.http.HttpServletRequest"); } catch (PolicyContextException e) { throw new RuntimeException("JACC error: " + e.getMessage()); } HttpSession httpSession = httpServletRequest.getSession(); X509Certificate certificate = certificateChain.get(0); httpSession.setAttribute("NationalRegistryCertificate", certificate); }
From source file:test.be.fedict.eid.applet.model.IdentitySignatureServiceBean.java
private HttpSession getHttpSession() { HttpServletRequest httpServletRequest; try {//from www . j a v a 2s. c o m httpServletRequest = (HttpServletRequest) PolicyContext .getContext("javax.servlet.http.HttpServletRequest"); } catch (PolicyContextException e) { throw new RuntimeException("JACC error: " + e.getMessage()); } HttpSession httpSession = httpServletRequest.getSession(); return httpSession; }
From source file:test.be.fedict.eid.applet.model.SecureClientEnvironmentCheckerBean.java
public void checkSecureClientEnvironment(String javaVersion, String javaVendor, String osName, String osArch, String osVersion, String userAgent, String navigatorAppName, String navigatorAppVersion, String navigatorUserAgent, String remoteAddress, Integer sslKeySize, String sslCipherSuite, List<String> readerList) throws SecurityException { LOG.debug("java version: " + javaVersion); LOG.debug("java vendor: " + javaVendor); LOG.debug("OS name: " + osName); LOG.debug("OS arch: " + osArch); LOG.debug("OS version: " + osVersion); LOG.debug("user agent: " + userAgent); LOG.debug("navigator app name: " + navigatorAppName); LOG.debug("navigator app version: " + navigatorAppVersion); LOG.debug("navigator user agent: " + navigatorUserAgent); LOG.debug("remote address: " + remoteAddress); LOG.debug("ssl key size: " + sslKeySize); LOG.debug("ssl cipher suite: " + sslCipherSuite); LOG.debug("readers: " + readerList); HttpServletRequest httpServletRequest; try {/*from www . j a v a2 s.c om*/ httpServletRequest = (HttpServletRequest) PolicyContext .getContext("javax.servlet.http.HttpServletRequest"); } catch (PolicyContextException e) { throw new RuntimeException("JACC error: " + e.getMessage()); } HttpSession httpSession = httpServletRequest.getSession(); httpSession.setAttribute("ClientJavaVersion", javaVersion); httpSession.setAttribute("ClientJavaVendor", javaVendor); httpSession.setAttribute("ClientOSName", osName); httpSession.setAttribute("ClientOSArch", osArch); httpSession.setAttribute("ClientOSVersion", osVersion); httpSession.setAttribute("ClientReaders", readerList.toString()); httpSession.setAttribute("ClientUserAgent", userAgent); httpSession.setAttribute("ClientSslCipherSuite", sslCipherSuite); httpSession.setAttribute("ClientRemoteAddress", remoteAddress); httpSession.setAttribute("ClientSslKeySize", sslKeySize); httpSession.setAttribute("ClientNavigatorUserAgent", navigatorUserAgent); httpSession.setAttribute("ClientNavigatorAppName", navigatorAppName); httpSession.setAttribute("ClientNavigatorAppVersion", navigatorAppVersion); }
From source file:test.be.fedict.eid.applet.model.SignatureServiceBean.java
public DigestInfo preSign(List<DigestInfo> digestInfos, List<X509Certificate> signingCertificateChain) throws NoSuchAlgorithmException { LOG.debug("preSign"); HttpServletRequest httpServletRequest; try {/*from ww w . j ava 2 s. c o m*/ httpServletRequest = (HttpServletRequest) PolicyContext .getContext("javax.servlet.http.HttpServletRequest"); } catch (PolicyContextException e) { throw new RuntimeException("JACC error: " + e.getMessage()); } HttpSession session = httpServletRequest.getSession(); String toBeSigned = (String) session.getAttribute("toBeSigned"); String digestAlgo = (String) session.getAttribute("digestAlgo"); LOG.debug("digest algo: " + digestAlgo); MessageDigest messageDigest = MessageDigest.getInstance(digestAlgo, new BouncyCastleProvider()); byte[] digestValue = messageDigest.digest(toBeSigned.getBytes()); String description = "Test Text Document"; return new DigestInfo(digestValue, digestAlgo, description); }