Code Duplication    Length = 11-13 lines in 5 locations

plugin/sepe/src/wsse/xmlseclibs.php 5 locations

@@ 249-261 (lines=13) @@
246
                }
247
                throw new Exception('Certificate "type" (private/public) must be passed via parameters');
248
                return;
249
            case (self::RSA_OAEP_MGF1P):
250
                $this->cryptParams['library'] = 'openssl';
251
                $this->cryptParams['padding'] = OPENSSL_PKCS1_OAEP_PADDING;
252
                $this->cryptParams['method'] = 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p';
253
                $this->cryptParams['hash'] = NULL;
254
                if (is_array($params) && ! empty($params['type'])) {
255
                    if ($params['type'] == 'public' || $params['type'] == 'private') {
256
                        $this->cryptParams['type'] = $params['type'];
257
                        break;
258
                    }
259
                }
260
                throw new Exception('Certificate "type" (private/public) must be passed via parameters');
261
                return;
262
            case (self::RSA_SHA1):
263
                $this->cryptParams['library'] = 'openssl';
264
                $this->cryptParams['method'] = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1';
@@ 262-273 (lines=12) @@
259
                }
260
                throw new Exception('Certificate "type" (private/public) must be passed via parameters');
261
                return;
262
            case (self::RSA_SHA1):
263
                $this->cryptParams['library'] = 'openssl';
264
                $this->cryptParams['method'] = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1';
265
                $this->cryptParams['padding'] = OPENSSL_PKCS1_PADDING;
266
                if (is_array($params) && ! empty($params['type'])) {
267
                    if ($params['type'] == 'public' || $params['type'] == 'private') {
268
                        $this->cryptParams['type'] = $params['type'];
269
                        break;
270
                    }
271
                }
272
                throw new Exception('Certificate "type" (private/public) must be passed via parameters');
273
                break;
274
            case (self::RSA_SHA256):
275
                $this->cryptParams['library'] = 'openssl';
276
                $this->cryptParams['method'] = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256';
@@ 274-286 (lines=13) @@
271
                }
272
                throw new Exception('Certificate "type" (private/public) must be passed via parameters');
273
                break;
274
            case (self::RSA_SHA256):
275
                $this->cryptParams['library'] = 'openssl';
276
                $this->cryptParams['method'] = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256';
277
                $this->cryptParams['padding'] = OPENSSL_PKCS1_PADDING;
278
                $this->cryptParams['digest'] = 'SHA256';
279
                if (is_array($params) && ! empty($params['type'])) {
280
                    if ($params['type'] == 'public' || $params['type'] == 'private') {
281
                        $this->cryptParams['type'] = $params['type'];
282
                        break;
283
                    }
284
                }
285
                throw new Exception('Certificate "type" (private/public) must be passed via parameters');
286
                break;
287
            case (self::RSA_SHA384):
288
                $this->cryptParams['library'] = 'openssl';
289
                $this->cryptParams['method'] = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha384';
@@ 287-297 (lines=11) @@
284
                }
285
                throw new Exception('Certificate "type" (private/public) must be passed via parameters');
286
                break;
287
            case (self::RSA_SHA384):
288
                $this->cryptParams['library'] = 'openssl';
289
                $this->cryptParams['method'] = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha384';
290
                $this->cryptParams['padding'] = OPENSSL_PKCS1_PADDING;
291
                $this->cryptParams['digest'] = 'SHA384';
292
                if (is_array($params) && ! empty($params['type'])) {
293
                    if ($params['type'] == 'public' || $params['type'] == 'private') {
294
                        $this->cryptParams['type'] = $params['type'];
295
                        break;
296
                    }
297
                }
298
            case (self::RSA_SHA512):
299
                $this->cryptParams['library'] = 'openssl';
300
                $this->cryptParams['method'] = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512';
@@ 298-308 (lines=11) @@
295
                        break;
296
                    }
297
                }
298
            case (self::RSA_SHA512):
299
                $this->cryptParams['library'] = 'openssl';
300
                $this->cryptParams['method'] = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512';
301
                $this->cryptParams['padding'] = OPENSSL_PKCS1_PADDING;
302
                $this->cryptParams['digest'] = 'SHA512';
303
                if (is_array($params) && ! empty($params['type'])) {
304
                    if ($params['type'] == 'public' || $params['type'] == 'private') {
305
                        $this->cryptParams['type'] = $params['type'];
306
                        break;
307
                    }
308
                }
309
            default:
310
                throw new Exception('Invalid Key Type');
311
                return;