add config to key generation
This commit is contained in:
parent
edf3da1573
commit
60d877f35d
2 changed files with 9 additions and 2 deletions
2
armor.go
2
armor.go
|
|
@ -22,7 +22,7 @@ func ArmorKey(input []byte) (string, error) {
|
||||||
// ArmorWithType make bytes input to armor format
|
// ArmorWithType make bytes input to armor format
|
||||||
func ArmorWithType(input []byte, armorType string) (string, error) {
|
func ArmorWithType(input []byte, armorType string) (string, error) {
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
w, err := armor.Encode(&b, armorType, nil)
|
w, err := armor.Encode(&b, armorType, armorHeader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
9
key.go
9
key.go
|
|
@ -2,6 +2,7 @@ package pm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"crypto"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
@ -162,7 +163,13 @@ func (o *OpenPGP) GenerateKey(userName string, domain string, passphrase string,
|
||||||
return o.getNow()
|
return o.getNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg := &packet.Config{RSABits: bits, Time: timeNow}
|
cfg := &packet.Config{
|
||||||
|
RSABits: bits,
|
||||||
|
Time: timeNow,
|
||||||
|
DefaultHash: crypto.SHA256,
|
||||||
|
DefaultCipher: packet.CipherAES256,
|
||||||
|
}
|
||||||
|
|
||||||
newEntity, err := openpgp.NewEntity(email, comments, email, cfg)
|
newEntity, err := openpgp.NewEntity(email, comments, email, cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue