| // Copyright 2015 The Vanadium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| "v.io/x/ref/services/internal/restsigner" |
| signer, err := restsigner.NewRestSigner() |
| fmt.Printf("NewRestSigner error: %v\n", err) |
| der, err := signer.PublicKey().MarshalBinary() |
| fmt.Printf("Failed to marshal public key: %v\n", err) |
| sig, err := signer.Sign([]byte("purpose"), []byte("message")) |
| fmt.Printf("Sign error: %v\n", err) |
| ok := sig.Verify(signer.PublicKey(), []byte("message")) |
| fmt.Printf("PublicKey: %v\n", base64.URLEncoding.EncodeToString(der)) |
| fmt.Printf("R: %v\n", big.NewInt(0).SetBytes(sig.R)) |
| fmt.Printf("S: %v\n", big.NewInt(0).SetBytes(sig.S)) |
| fmt.Printf("Verified: %v\n", ok) |