mmauth

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractHeader

func ExtractHeader(headers []string, key string) string

ヘッダリストから指定されたヘッダを削除する 存在しない場合は空文字列を返す

func ExtractHeadersARC

func ExtractHeadersARC(headers []string, keys []string) []string

ヘッダリストから指定された複数のヘッダをARC署名順で抽出する

func ExtractHeadersDKIM

func ExtractHeadersDKIM(headers []string, keys []string) []string

ヘッダリストから指定された複数のヘッダをDKIM署名順で抽出する

func ParseAddress

func ParseAddress(s string) string

ヘッダからアドレスを取得する

func ParseAddressDomain

func ParseAddressDomain(s string) (string, error)

アドレスからドメイン部分を取得する

Types

type ARCSignatures

type ARCSignatures []*arc.Signature

func ParseARCHeaders

func ParseARCHeaders(headers []string) (*ARCSignatures, error)

ARCヘッダをパースする

func (*ARCSignatures) GetARCChainValidation

func (s *ARCSignatures) GetARCChainValidation() arc.ChainValidationResult

既存のARC-SealのCV結果をチェックしarc.ChainValidationResultを返す i=1がNone以外の場合はFail それ以外のインスタンスがPassでなければFail

func (*ARCSignatures) GetARCHeaders

func (s *ARCSignatures) GetARCHeaders() []string

ARCヘッダをSealで署名する順番にソートする

func (*ARCSignatures) GetInstance

func (s *ARCSignatures) GetInstance(i int) *arc.Signature

インスタンス番号を指定してSignatureを取得する

func (*ARCSignatures) GetMaxInstance

func (s *ARCSignatures) GetMaxInstance() int

最大のインスタンス番号を取得する

func (*ARCSignatures) GetVerifyResult

func (s *ARCSignatures) GetVerifyResult() arc.VerifyStatus

最後のARCのVerify結果を取得する

func (*ARCSignatures) GetVerifyResultString

func (s *ARCSignatures) GetVerifyResultString() string

最後のARCのVerify結果を文字列で取得する

type AuthenticationHeaders

type AuthenticationHeaders struct {
	DKIMSignatures *DKIMSignatures
	ARCSignatures  *ARCSignatures
}

認証ヘッダを保持する構造体

func (*AuthenticationHeaders) BodyHashCanonAndAlgo

func (a *AuthenticationHeaders) BodyHashCanonAndAlgo() []BodyCanonicalizationAndAlgorithm

type BodyCanonicalizationAndAlgorithm

type BodyCanonicalizationAndAlgorithm struct {
	Body      Canonicalization
	Algorithm crypto.Hash
	Limit     int64
}

type BodyHash

type BodyHash struct {
	Algorithm *BodyCanonicalizationAndAlgorithm
	BodyHash  string
	Limit     int64
}

BodyHashの種別

type Canonicalization

type Canonicalization canonical.Canonicalization
const (
	CanonicalizationSimple  Canonicalization = "simple"
	CanonicalizationRelaxed Canonicalization = "relaxed"
)

type DKIMSignatures

type DKIMSignatures []*dkim.Signature

func ParseDKIMHeaders

func ParseDKIMHeaders(headers []string) (*DKIMSignatures, error)

func (*DKIMSignatures) GetResult

func (d *DKIMSignatures) GetResult() dkim.VerifyStatus

type MMAuth

type MMAuth struct {
	AuthenticationHeaders *AuthenticationHeaders
	Headers               headers
	// contains filtered or unexported fields
}

DKIMとARCの署名の検証を行うための構造体

func NewMMAuth

func NewMMAuth() *MMAuth

DKIM、ARCの署名を行うための構造体の初期化

func (*MMAuth) AddBodyHash

func (m *MMAuth) AddBodyHash(bca BodyCanonicalizationAndAlgorithm)

生成すべきBodyHashの種類を追加する

func (*MMAuth) Close

func (m *MMAuth) Close() error

メールメッセージ処理の終了

func (*MMAuth) GetBodyHash

func (m *MMAuth) GetBodyHash(bca BodyCanonicalizationAndAlgorithm) string

func (*MMAuth) Verify

func (m *MMAuth) Verify()

付与されているDKIM・ARCの署名検証を行う

func (*MMAuth) Write

func (m *MMAuth) Write(p []byte) (n int, err error)

ヘッダ、本文の書き込み

type SignatureAlgorithm

type SignatureAlgorithm string

DKIM ARCの署名アルゴリズム

const (
	SignatureAlgorithmRSA_SHA1       SignatureAlgorithm = "rsa-sha1"
	SignatureAlgorithmRSA_SHA256     SignatureAlgorithm = "rsa-sha256"
	SignatureAlgorithmED25519_SHA256 SignatureAlgorithm = "ed25519-sha256"
)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL