File tree Expand file tree Collapse file tree
src/main/java/com/onelogin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,12 +31,19 @@ public void setIdpSsoTargetUrl(String idp_sso_target_url) {
3131 * @param certificate an base64 encoded string.
3232 */
3333 public void loadCertificate (String certificate ) throws CertificateException {
34- CertificateFactory fty = CertificateFactory .getInstance ("X.509" );
35- ByteArrayInputStream bais = new ByteArrayInputStream (Base64 .decodeBase64 (certificate .getBytes ()));
36- this .idp_cert = fty .generateCertificate (bais );
34+ loadCertificate (certificate , false );
3735 }
3836
39-
37+ public void loadCertificate (String certificate , boolean isBase64 ) throws CertificateException {
38+ CertificateFactory fty = CertificateFactory .getInstance ("X.509" );
39+ byte [] cert = certificate .getBytes ();
40+ if (isBase64 ) {
41+ cert = Base64 .decodeBase64 (cert );
42+ }
43+ ByteArrayInputStream bais = new ByteArrayInputStream (cert );
44+ this .idp_cert = fty .generateCertificate (bais );
45+ }
46+
4047 public Certificate getIdpCert () throws CertificateException {
4148 if (this .idp_cert == null ){
4249 loadCertificate (this .certificate );
You can’t perform that action at this time.
0 commit comments