Documentation ¶
Index ¶
- Constants
- func GeneratePassword() (string, error)
- func GetHashedPassword(password string) (string, error)
- func VerifyPassword(hashedPass, password string) error
- type CertData
- func CreateCACert(req *CreateCACertRequest) (*CertData, error)
- func CreateClientCert(serial uint32, commonName string, ca *CertData) (*CertData, error)
- func CreateServerCert(req *CreateServerCertRequest, ca *CertData) (*CertData, error)
- func ToCertData(password string, tcert models.TranCertificate) (*CertData, error)
- type CertType
- type CreateCACertRequest
- type CreateServerCertRequest
- type PrivateKey
- type PrivateKeyAlgorithm
Constants ¶
View Source
const ( DT_FORMAT string = "2006-01-02T15:04:05" CA_EXPIRE time.Duration = 3153600000 * time.Second // 100年 SV_EXPIRE time.Duration = 33696000 * time.Second // 390日 CL_EXPIRE time.Duration = 3153600000 * time.Second // 100年 UNKNOWN_CERT_TYPE CertType = "UNKNOWN" CA CertType = "CA" SERVER CertType = "SERVER" CLIENT CertType = "CLIENT" )
Variables ¶
This section is empty.
Functions ¶
func VerifyPassword ¶
パスワードとハッシュ化されたパスワードを照合します
Types ¶
type CertData ¶
type CertData struct { CAID string Serial uint32 CommonName string PrivateKey PrivateKey Type CertType PemData string Created string ExpirationDate string }
func CreateClientCert ¶
クライアント証明書を発行します
func CreateServerCert ¶
func CreateServerCert( req *CreateServerCertRequest, ca *CertData) (*CertData, error)
サーバ証明書を発行します
func ToCertData ¶
func ToCertData( password string, tcert models.TranCertificate) (*CertData, error)
DB上の証明書情報をプログラム内部で扱う証明書情報に変換します
func (*CertData) TranCertificate ¶
func (c *CertData) TranCertificate( password string) (models.TranCertificate, error)
プログラム内部で扱う証明書情報をDB上の証明書情報に変換します
type CreateCACertRequest ¶ added in v0.0.2
type CreateCACertRequest struct { CAID string PrivateKey PrivateKey Subject pkix.Name Serial uint32 }
type CreateServerCertRequest ¶ added in v0.0.2
type PrivateKey ¶
type PrivateKey struct { Algorithm PrivateKeyAlgorithm Key crypto.Signer }
func GenerateECDSAKey ¶
func GenerateECDSAKey(bits int) (PrivateKey, error)
ECDSA PrivateKeyを生成します
※P-256, P-384, P-521にのみ対応しています
func GenerateRSAKey ¶
func GenerateRSAKey(bits int) (PrivateKey, error)
RSA PrivateKeyを生成します
※2048bit, 4096bitにのみ対応しています
func (PrivateKey) ToPem ¶ added in v0.1.0
func (priv PrivateKey) ToPem() (string, error)
PrivateKey構造体からPEM形式のデータに変換します
type PrivateKeyAlgorithm ¶
type PrivateKeyAlgorithm string
const ( UNKNOWN_ALGORITHM PrivateKeyAlgorithm = "UNKNOWN" RSA PrivateKeyAlgorithm = "RSA" ECDSA PrivateKeyAlgorithm = "ECDSA" ED25519 PrivateKeyAlgorithm = "ED25519" )
Click to show internal directories.
Click to hide internal directories.