Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
admpub committed Jul 1, 2021
1 parent eb75533 commit 5941d86
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion rsa_private_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import (
// 设置私钥
func NewRSAPrivateKey(privateKey []byte) (r *RSAPrivateKey, err error) {
r = &RSAPrivateKey{}
err = r.SetPrivateKeyBytes(privateKey)
if privateKey != nil {
err = r.SetPrivateKeyBytes(privateKey)
}
return
}

Expand Down
4 changes: 3 additions & 1 deletion rsa_public_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import (
// 设置公钥
func NewRSAPublicKey(publicKey []byte) (r *RSAPublicKey, err error) {
r = &RSAPublicKey{}
err = r.SetPublicKeyBytes(publicKey)
if publicKey != nil {
err = r.SetPublicKeyBytes(publicKey)
}
return
}

Expand Down

0 comments on commit 5941d86

Please sign in to comment.