aboutsummaryrefslogtreecommitdiff
path: root/cipher.go
diff options
context:
space:
mode:
Diffstat (limited to 'cipher.go')
-rw-r--r--cipher.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/cipher.go b/cipher.go
index 057cf97..6b0266e 100644
--- a/cipher.go
+++ b/cipher.go
@@ -121,3 +121,13 @@ func (cs *CipherState) Clear() {
cs.aead = nil
cs.nonce = 0
}
+
+// Key returns a copy of the cipher key.
+func (cs *CipherState) Key() []byte {
+ if cs.key == nil {
+ return nil
+ }
+ key := make([]byte, len(cs.key))
+ copy(key, cs.key)
+ return key
+}