Created
August 17, 2017 12:36
-
-
Save jaimeperez/ece28cd1f980c58dcba4b250ea52a8d1 to your computer and use it in GitHub Desktop.
A script to encrypt two-factor authenticator secrets for Feide
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| include("vendor/autoload.php"); | |
| // JSON-encode the Authenticator secret | |
| $plaintext = array("secret" => "<AUTHENTICATOR_SECRET"); | |
| // initialize JWE object | |
| $jwe = new JOSE_JWE(json_encode($plaintext)); | |
| // encrypt with Feide's key and proper algorithms | |
| $jwe->encrypt( | |
| '<FEIDE_AUTHENTICATOR_PUBLIC_KEY>', | |
| 'RSA-OAEP', | |
| 'A128CBC-HS256' | |
| ); | |
| // print the result | |
| echo $jwe->toString(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment