Minor build fixes

This commit is contained in:
Jakub Lehotsky 2018-11-01 17:03:43 +01:00
parent b3e6e67cac
commit 0bf075d49d
19 changed files with 40 additions and 39 deletions

3
.gitignore vendored
View file

@ -1,4 +1,5 @@
.DS_Store .DS_Store
bin bin
dist
vendor vendor
.vscode .vscode

View file

@ -3,8 +3,8 @@ package armor
import ( import (
"bytes" "bytes"
"errors" "errors"
"gitlab.com/ProtonMail/go-pm-crypto/internal" "github.com/ProtonMail/go-pm-crypto/internal"
"gitlab.com/ProtonMail/go-pm-crypto/models" "github.com/ProtonMail/go-pm-crypto/models"
"golang.org/x/crypto/openpgp/armor" "golang.org/x/crypto/openpgp/armor"
"golang.org/x/crypto/openpgp/clearsign" "golang.org/x/crypto/openpgp/clearsign"
"golang.org/x/crypto/openpgp/packet" "golang.org/x/crypto/openpgp/packet"

View file

@ -1,7 +1,7 @@
package armor package armor
import ( import (
"gitlab.com/ProtonMail/go-pm-crypto/internal" "github.com/ProtonMail/go-pm-crypto/internal"
) )
const ( const (

View file

@ -10,12 +10,13 @@ mkdir -p $IOS_OUT
# CHECK="${1-0}" # CHECK="${1-0}"
# if [ ${CHECK} -eq "1" ]; then # if [ ${CHECK} -eq "1" ]; then
printf "\e[0;32mStart Building iOS framework .. Location: ${IOS_OUT} \033[0m\n\n" printf "\e[0;32mStart Building iOS framework .. Location: ${IOS_OUT} \033[0m\n\n"
PACKAGE_PATH=github.com/ProtonMail/go-pm-crypto
gomobile bind -target ios -o ${IOS_OUT}/pmcrypto.framework proton/pmcrypto/crypto proton/pmcrypto/armor proton/pmcrypto/constants proton/pmcrypto/key proton/pmcrypto/models gomobile bind -target ios -o ${IOS_OUT}/pmcrypto.framework $PACKAGE_PATH/crypto $PACKAGE_PATH/armor $PACKAGE_PATH/constants $PACKAGE_PATH/key $PACKAGE_PATH/models
printf "\e[0;32mStart Building Android lib .. Location: ${ANDROID_OUT} \033[0m\n\n" printf "\e[0;32mStart Building Android lib .. Location: ${ANDROID_OUT} \033[0m\n\n"
gomobile bind -target android -javapkg com.proton.pmcrypto -o ${ANDROID_OUT}/pmcrypto.aar proton/pmcrypto/crypto proton/pmcrypto/armor proton/pmcrypto/constants proton/pmcrypto/key proton/pmcrypto/models gomobile bind -target android -javapkg com.proton.pmcrypto -o ${ANDROID_OUT}/pmcrypto.aar $PACKAGE_PATH/crypto $PACKAGE_PATH/armor $PACKAGE_PATH/constants $PACKAGE_PATH/key $PACKAGE_PATH/models
printf "\e[0;32mInstalling frameworks. \033[0m\n\n" printf "\e[0;32mInstalling frameworks. \033[0m\n\n"

View file

@ -5,9 +5,9 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
armorUtils "gitlab.com/ProtonMail/go-pm-crypto/armor" armorUtils "github.com/ProtonMail/go-pm-crypto/armor"
"gitlab.com/ProtonMail/go-pm-crypto/internal" "github.com/ProtonMail/go-pm-crypto/internal"
"gitlab.com/ProtonMail/go-pm-crypto/models" "github.com/ProtonMail/go-pm-crypto/models"
"golang.org/x/crypto/openpgp" "golang.org/x/crypto/openpgp"
"golang.org/x/crypto/openpgp/armor" "golang.org/x/crypto/openpgp/armor"
"golang.org/x/crypto/openpgp/packet" "golang.org/x/crypto/openpgp/packet"

View file

@ -8,7 +8,7 @@ import (
"strings" "strings"
"time" "time"
"gitlab.com/ProtonMail/go-pm-crypto/armor" "github.com/ProtonMail/go-pm-crypto/armor"
"golang.org/x/crypto/openpgp" "golang.org/x/crypto/openpgp"
"golang.org/x/crypto/openpgp/packet" "golang.org/x/crypto/openpgp/packet"
"math/big" "math/big"

View file

@ -8,9 +8,9 @@ import (
"strings" "strings"
"time" "time"
armorUtils "gitlab.com/ProtonMail/go-pm-crypto/armor" armorUtils "github.com/ProtonMail/go-pm-crypto/armor"
"gitlab.com/ProtonMail/go-pm-crypto/internal" "github.com/ProtonMail/go-pm-crypto/internal"
"gitlab.com/ProtonMail/go-pm-crypto/models" "github.com/ProtonMail/go-pm-crypto/models"
"golang.org/x/crypto/openpgp" "golang.org/x/crypto/openpgp"
"golang.org/x/crypto/openpgp/armor" "golang.org/x/crypto/openpgp/armor"
errors2 "golang.org/x/crypto/openpgp/errors" errors2 "golang.org/x/crypto/openpgp/errors"

View file

@ -2,8 +2,8 @@ package crypto
import ( import (
"bytes" "bytes"
"github.com/ProtonMail/go-pm-crypto/armor"
"github.com/ProtonMail/go-pm-mime" "github.com/ProtonMail/go-pm-mime"
"gitlab.com/ProtonMail/go-pm-crypto/armor"
"golang.org/x/crypto/openpgp" "golang.org/x/crypto/openpgp"
"golang.org/x/crypto/openpgp/packet" "golang.org/x/crypto/openpgp/packet"
"io/ioutil" "io/ioutil"

View file

@ -7,8 +7,8 @@ import (
"io" "io"
"strings" "strings"
"gitlab.com/ProtonMail/go-pm-crypto/armor" "github.com/ProtonMail/go-pm-crypto/armor"
"gitlab.com/ProtonMail/go-pm-crypto/models" "github.com/ProtonMail/go-pm-crypto/models"
"golang.org/x/crypto/openpgp" "golang.org/x/crypto/openpgp"
"golang.org/x/crypto/openpgp/packet" "golang.org/x/crypto/openpgp/packet"
) )

View file

@ -6,7 +6,7 @@ import (
"strings" "strings"
"time" "time"
"gitlab.com/ProtonMail/go-pm-crypto/internal" "github.com/ProtonMail/go-pm-crypto/internal"
"golang.org/x/crypto/openpgp" "golang.org/x/crypto/openpgp"
errors2 "golang.org/x/crypto/openpgp/errors" errors2 "golang.org/x/crypto/openpgp/errors"
"golang.org/x/crypto/openpgp/packet" "golang.org/x/crypto/openpgp/packet"

Binary file not shown.

Binary file not shown.

6
glide.lock generated
View file

@ -31,7 +31,6 @@ imports:
- rsa - rsa
- ssh/terminal - ssh/terminal
- name: golang.org/x/sys - name: golang.org/x/sys
version: 8cf3aee429924738c56c34bb819c4ea8273fc434
subpackages: subpackages:
- unix - unix
- windows - windows
@ -43,7 +42,8 @@ imports:
- encoding/internal - encoding/internal
- encoding/internal/identifier - encoding/internal/identifier
- transform - transform
- name: proton/pmmime - name: github.com/ProtonMail/go-pm-mime
version: 347d69204aa62d6958bcb3b9bbacccb24a36372b version: 347d69204aa62d6958bcb3b9bbacccb24a36372b
repo: git@gitlab.protontech.ch:ProtonMail/go-pm-mime.git repo: https://gitlab.protontech.ch/ProtonMail/go-pm-mime.git
version: feat/mimevisitor
testImports: [] testImports: []

View file

@ -1,7 +1,9 @@
package: proton/pmcrypto package: proton/pmcrypto
import: import:
- package: golang.org/x/crypto - package: golang.org/x/crypto
version: v1.0.0 version: master
repo: https://github.com/ProtonMail/crypto.git repo: https://github.com/ProtonMail/crypto.git
- package: proton/pmmime version: 9e4251120d8c43f10024d798bc6dde21d40704a0
repo: git@gitlab.protontech.ch:ProtonMail/go-pm-mime.git - package: github.com/ProtonMail/go-pm-mime
repo: https://gitlab.protontech.ch/ProtonMail/go-pm-mime.git

View file

@ -1,7 +1,7 @@
package internal package internal
import ( import (
"gitlab.com/ProtonMail/go-pm-crypto/constants" "github.com/ProtonMail/go-pm-crypto/constants"
"regexp" "regexp"
) )

View file

@ -5,8 +5,8 @@ import (
"encoding/hex" "encoding/hex"
"errors" "errors"
"github.com/ProtonMail/go-pm-crypto/armor"
"golang.org/x/crypto/openpgp" "golang.org/x/crypto/openpgp"
"proton/pmcrypto/armor"
) )
// GetFingerprint get a armored public key fingerprint // GetFingerprint get a armored public key fingerprint

View file

@ -1,12 +1,12 @@
package key package key
import ( import (
"strings"
"golang.org/x/crypto/openpgp"
"fmt"
"golang.org/x/crypto/openpgp/packet"
"bytes" "bytes"
"proton/pmcrypto/armor" "fmt"
"github.com/ProtonMail/go-pm-crypto/armor"
"golang.org/x/crypto/openpgp"
"golang.org/x/crypto/openpgp/packet"
"strings"
) )
//CheckPassphrase check is private key passphrase ok //CheckPassphrase check is private key passphrase ok
@ -39,7 +39,6 @@ func CheckPassphrase(privateKey string, passphrase string) bool {
return true return true
} }
// PublicKey get a public key from a private key // PublicKey get a public key from a private key
func PublicKey(privateKey string) (string, error) { func PublicKey(privateKey string) (string, error) {
privKeyReader := strings.NewReader(privateKey) privKeyReader := strings.NewReader(privateKey)

View file

@ -11,7 +11,7 @@ import (
// "net/url" // "net/url"
"strings" "strings"
//"gitlab.com/ProtonMail/go-pm-crypto/armor" //"github.com/ProtonMail/go-pm-crypto/armor"
"golang.org/x/crypto/openpgp" "golang.org/x/crypto/openpgp"
"golang.org/x/crypto/openpgp/packet" "golang.org/x/crypto/openpgp/packet"
) )

View file

@ -12,16 +12,14 @@ import (
"time" "time"
"golang.org/x/crypto/openpgp" "golang.org/x/crypto/openpgp"
"golang.org/x/crypto/openpgp/armor" //"golang.org/x/crypto/openpgp/armor"
pgperrors "golang.org/x/crypto/openpgp/errors" pgperrors "golang.org/x/crypto/openpgp/errors"
"golang.org/x/crypto/openpgp/packet" "golang.org/x/crypto/openpgp/packet"
"gitlab.com/ProtonMail/go-pm-crypto/crypto" armorUtils "github.com/ProtonMail/go-pm-crypto/armor"
"github.com/ProtonMail/go-pm-crypto/crypto"
) )
// Armored type for PGP encrypted messages.
const pgpMessageType = "PGP MESSAGE"
// A keypair contains a private key and a public key. // A keypair contains a private key and a public key.
type pmKeyObject struct { type pmKeyObject struct {
ID string ID string
@ -188,7 +186,7 @@ func (w *armorEncryptWriter) Close() (err error) {
// EncryptArmored encrypts and armors data to the keyring's owner. // EncryptArmored encrypts and armors data to the keyring's owner.
func (kr *KeyRing) EncryptArmored(w io.Writer, sign *KeyRing) (wc io.WriteCloser, err error) { func (kr *KeyRing) EncryptArmored(w io.Writer, sign *KeyRing) (wc io.WriteCloser, err error) {
aw, err := armor.Encode(w, pgpMessageType, nil) aw, err := armorUtils.ArmorWithTypeBuffered(w, armorUtils.MESSAGE_HEADER)
if err != nil { if err != nil {
return return
} }
@ -367,7 +365,7 @@ func (kr *KeyRing) DecryptArmored(r io.Reader) (decrypted io.Reader, signed *Sig
return return
} }
if block.Type != pgpMessageType { if block.Type != armorUtils.MESSAGE_HEADER {
err = errors.New("pmapi: not an armored PGP message") err = errors.New("pmapi: not an armored PGP message")
return return
} }