Created
July 3, 2012 13:49
-
-
Save beelsebob/3039787 to your computer and use it in GitHub Desktop.
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
| Salt: D1CE20E851F7DD8D70C5C6B045D3B5800F7CBEEC | |
| Verifier: 6B920A43C958E0DEB0F1A395DFD647044F566925AA4FC589E4AA179B703C09B80FD95249EBD59FA4EFF05F4058AB961395F482312A80D8883C0D5E4E21C1AE574CD2B92330730F4B3755A8BA07FA8A1C181E1CFFEAA9838EB09B10E8941418B960A8E255A08C9530564483386AC4B09299492A094537974B96E2FADC92186563 | |
| A is valid mod N | |
| B is valid mod N | |
| Client Key: 8CF16D124BBE47D480585A47AA799FA684307589AD74B0C064C1E61460897F226B631BF563E9CD5BC31B000FC1616DA0E7B445504A76FB1A067FA6142F2FC6C181FE2DCAE7EDDB6749A795F248C5E597212D7688DF8AD60137610CD5E0ACFEF8DCB63B95230D3EA77081F9850F11EAE53B86313230B62529CD19F123847D5A7E | |
| Server Key: 8CF16D124BBE47D480585A47AA799FA684307589AD74B0C064C1E61460897F226B631BF563E9CD5BC31B000FC1616DA0E7B445504A76FB1A067FA6142F2FC6C181FE2DCAE7EDDB6749A795F248C5E597212D7688DF8AD60137610CD5E0ACFEF8DCB63B95230D3EA77081F9850F11EAE53B86313230B62529CD19F123847D5A7E |
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
| package main | |
| import ( | |
| "openssl/srp" | |
| "fmt" | |
| ) | |
| func main() { | |
| g, N := srp.Get_default_gN("1024") | |
| s, v := srp.Create_verifier_BN("bob", "poo", g, N) | |
| salt, verifier := *s, *v | |
| fmt.Printf("Salt: %s\nVerifier: %s\n", srp.BN_bn2hex(salt), srp.BN_bn2hex(verifier)) | |
| a := srp.BN_rand(32, -1, 0) | |
| A := srp.Calc_A(a, N, g) | |
| if (srp.Verify_A_mod_N(A, N)) { | |
| fmt.Printf("A is valid mod N\n") | |
| } else { | |
| fmt.Printf("A is not valid mod N\n") | |
| } | |
| b := srp.BN_rand(32, -1, 0) | |
| B := srp.Calc_B(b, N, g, verifier) | |
| if (srp.Verify_B_mod_N(B, N)) { | |
| fmt.Printf("B is valid mod N\n") | |
| } else { | |
| fmt.Printf("B is not valid mod N\n") | |
| } | |
| x := srp.Calc_x(salt, "bob", "poo") | |
| u := srp.Calc_u(A, B, N) | |
| cK := srp.Calc_client_key(N, B, g, x, a, u) | |
| fmt.Printf("Client Key: %s\n", srp.BN_bn2hex(cK)) | |
| sK := srp.Calc_server_key(A, verifier, u, b, N) | |
| fmt.Printf("Server Key: %s\n", srp.BN_bn2hex(sK)) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment