add PassGetHexSubkeyIDsJSON helper for passforios
This commit is contained in:
parent
41389bb5b0
commit
4e27e861c7
1 changed files with 18 additions and 0 deletions
|
|
@ -10,6 +10,9 @@ import (
|
|||
"github.com/ProtonMail/go-crypto/openpgp"
|
||||
"io"
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func PassGetEncryptedMPI1(pgpMessage *crypto.PGPMessage) (encryptedMPI1 []byte, err error) {
|
||||
|
|
@ -55,6 +58,21 @@ Loop1:
|
|||
}
|
||||
|
||||
|
||||
func PassGetHexSubkeyIDsJSON(key *crypto.Key) []byte {
|
||||
subKeys := key.GetEntity().Subkeys
|
||||
hexSubkeyIDs := make([]string, len(subKeys))
|
||||
for i, subKey := range subKeys {
|
||||
hexSubkeyIDs[i] = fmt.Sprintf("%016v", strconv.FormatUint(subKey.PublicKey.KeyId, 16))
|
||||
}
|
||||
|
||||
result, err := json.Marshal(hexSubkeyIDs)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
func PassDecryptWithSessionKey(pgpMessage *crypto.PGPMessage, sk *crypto.SessionKey) (plain_message *crypto.PlainMessage, err error) {
|
||||
var p packet.Packet
|
||||
packets := packet.NewReader(pgpMessage.NewReader())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue