Subversion Repositories oidplus

Rev

Rev 699 | Rev 830 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 699 Rev 826
Line 266... Line 266...
266
                        $pubKey = OIDplus::config()->getValue('oidplus_public_key');
266
                        $pubKey = OIDplus::config()->getValue('oidplus_public_key');
267
                        $k = new \Firebase\JWT\Key($pubKey, 'RS256'); // RSA+SHA256 ist hardcoded in getPkiStatus() generation
267
                        $k = new \Firebase\JWT\Key($pubKey, 'RS256'); // RSA+SHA256 ist hardcoded in getPkiStatus() generation
268
                        $this->content = (array) \Firebase\JWT\JWT::decode($jwt, $k);
268
                        $this->content = (array) \Firebase\JWT\JWT::decode($jwt, $k);
269
                } else {
269
                } else {
270
                        $key = OIDplus::baseConfig()->getValue('SERVER_SECRET', '').'/OIDplusAuthContentStoreJWT';
270
                        $key = OIDplus::baseConfig()->getValue('SERVER_SECRET', '').'/OIDplusAuthContentStoreJWT';
271
                        $key = hash_pbkdf2('sha512', $key, '', 10000, 64/*256bit*/, false);
271
                        $key = hash_pbkdf2('sha512', $key, '', 10000, 32/*256bit*/, false);
272
                        $k = new \Firebase\JWT\Key($key, 'HS512'); // HMAC+SHA512 is hardcoded here
272
                        $k = new \Firebase\JWT\Key($key, 'HS512'); // HMAC+SHA512 is hardcoded here
273
                        $this->content = (array) \Firebase\JWT\JWT::decode($jwt, $k);
273
                        $this->content = (array) \Firebase\JWT\JWT::decode($jwt, $k);
274
                }
274
                }
275
        }
275
        }
276
 
276
 
Line 284... Line 284...
284
                if (OIDplus::getPkiStatus()) {
284
                if (OIDplus::getPkiStatus()) {
285
                        $privKey = OIDplus::config()->getValue('oidplus_private_key');
285
                        $privKey = OIDplus::config()->getValue('oidplus_private_key');
286
                        return \Firebase\JWT\JWT::encode($payload, $privKey, 'RS256'); // RSA+SHA256 ist hardcoded in getPkiStatus() generation
286
                        return \Firebase\JWT\JWT::encode($payload, $privKey, 'RS256'); // RSA+SHA256 ist hardcoded in getPkiStatus() generation
287
                } else {
287
                } else {
288
                        $key = OIDplus::baseConfig()->getValue('SERVER_SECRET', '').'/OIDplusAuthContentStoreJWT';
288
                        $key = OIDplus::baseConfig()->getValue('SERVER_SECRET', '').'/OIDplusAuthContentStoreJWT';
289
                        $key = hash_pbkdf2('sha512', $key, '', 10000, 64/*256bit*/, false);
289
                        $key = hash_pbkdf2('sha512', $key, '', 10000, 32/*256bit*/, false);
290
                        return \Firebase\JWT\JWT::encode($payload, $key, 'HS512'); // HMAC+SHA512 is hardcoded here
290
                        return \Firebase\JWT\JWT::encode($payload, $key, 'HS512'); // HMAC+SHA512 is hardcoded here
291
                }
291
                }
292
        }
292
        }
293
 
293
 
294
}
294
}