|
|
@ -27,6 +27,13 @@ func main() { |
|
|
|
} |
|
|
|
bobPublicKey := &bobPrivateKey.PublicKey |
|
|
|
|
|
|
|
trudyPrivateKey, err := rsa.GenerateKey(rand.Reader, 2048) |
|
|
|
if err != nil { |
|
|
|
fmt.Println(err) |
|
|
|
os.Exit(1) |
|
|
|
} |
|
|
|
trudyPublicKey := &trudyPrivateKey.PublicKey |
|
|
|
|
|
|
|
fmt.Println("Alice's Private Key : ", alicePrivateKey) |
|
|
|
fmt.Println() |
|
|
|
fmt.Println("Alice's Public key ", alicePublicKey) |
|
|
@ -124,4 +131,21 @@ func main() { |
|
|
|
} else { |
|
|
|
fmt.Println("Verify Signature successful!") |
|
|
|
} |
|
|
|
|
|
|
|
fmt.Printf("OAEP decrypted [%x] to \n[%s]\n", ciphertext2, plainText) |
|
|
|
fmt.Println() |
|
|
|
|
|
|
|
err = rsa.VerifyPSS( |
|
|
|
trudyPublicKey, |
|
|
|
newhash, |
|
|
|
hashed, |
|
|
|
signature, |
|
|
|
&opts) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
fmt.Println("Signature verification failed!") |
|
|
|
os.Exit(1) |
|
|
|
} else { |
|
|
|
fmt.Println("Verify Signature successful!") |
|
|
|
} |
|
|
|
} |
|
|
|