Documentation
¶
Index ¶
- Constants
- Variables
- func WrapWithWSSESoapEnvelope(dataXML, id string) (result string)
- type CertIssuer
- type CertOrganization
- type CertSubject
- type CertSubjectRole
- type CertType
- type Client
- func (cli *Client) Close() (err error)
- func (cli *Client) GetCertFromCMS(cms []byte, signID int) (string, error)
- func (cli *Client) GetCertFromXML(xml string, signID int) ([]byte, error)
- func (cli *Client) GetTimeFromSig(signature []byte, signID int) (time.Time, error)
- func (cli *Client) HashGOST95(data []byte) (hashed []byte, err error)
- func (cli *Client) HashSHA256(data []byte) (hashed []byte, err error)
- func (cli *Client) LoadCertFromBytes(cert []byte, certType ckalkan.CertType) (err error)
- func (cli *Client) LoadCerts() error
- func (cli *Client) LoadKeyStore(path, password string) error
- func (cli *Client) LoadKeyStoreFromBytes(key []byte, password string) (err error)
- func (cli *Client) Options() Options
- func (cli *Client) Sign(data []byte, isDetached, withTSP bool) (signature []byte, err error)
- func (cli *Client) SignWSSE(xmlData, id string) (string, error)
- func (cli *Client) SignXML(xmlData string) (string, error)
- func (cli *Client) ValidateCert(cert string) (string, error)
- func (cli *Client) ValidateCertOCSP(cert string, url ...string) (string, error)
- func (cli *Client) Verify(signature []byte) (string, error)
- func (cli *Client) VerifyDetached(signature, data []byte) (string, error)
- func (cli *Client) VerifyXML(signedXML string) (result string, err error)
- func (cli *Client) X509CertificateGetInfo(cert string, prop ckalkan.CertProp) (string, error)
- func (cli *Client) X509CertificateGetSummary(cert string) (*Summary, error)
- type Kalkan
- type Logger
- type Option
- func WithCert(cert *x509.Certificate, typ ckalkan.CertType) Option
- func WithCerts(c []OptionsCert) Option
- func WithLogger(logger Logger) Option
- func WithOCSP(u string) Option
- func WithRemoteProdCerts(ctx context.Context) Option
- func WithRemoteTestCerts(ctx context.Context) Option
- func WithTSP(u string) Option
- type Options
- type OptionsCert
- type Summary
Constants ¶
View Source
const ( CertTypeIndividual = "individual" CertTypeOrganization = "organization" )
Variables ¶
View Source
var ( OptsProd = []Option{ WithLogger(defaultLogger), WithTSP(prodTSP), WithOCSP(prodOCSP), } OptsTest = []Option{ WithLogger(defaultLogger), WithTSP(testTSP), WithOCSP(testOCSP), } )
View Source
var ( ErrInit = errors.New("unable to refer to KC_GetFunctionList") ErrHTTPCli = errors.New("http cli error") )
View Source
var ErrLoadKey = errors.New("load key error")
Functions ¶
func WrapWithWSSESoapEnvelope ¶
WrapWithWSSESoapEnvelope оборачивает XML документ в SOAP формат, а точнее записывает содержимое под тегом soap:Body
Types ¶
type CertIssuer ¶
type CertOrganization ¶
type CertOrganization struct {
Name string
BIN string
SubjectRole CertSubjectRole
}
type CertSubject ¶
type CertSubjectRole ¶
type CertSubjectRole int
const ( CertSubjectRoleUndefined CertSubjectRole = iota CertSubjectRoleCEO CertSubjectRoleSign CertSubjectRoleSignFinance CertSubjectRoleHR CertSubjectRoleEmployee )
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetCertFromCMS ¶
GetCertFromCMS обеспечивает получение сертификата из CMS.
func (*Client) GetCertFromXML ¶
GetCertFromXML обеспечивает получение сертификата из XML.
func (*Client) GetTimeFromSig ¶
func (*Client) LoadCertFromBytes ¶
func (*Client) LoadKeyStore ¶
LoadKeyStore загружает PKCS12.
func (*Client) LoadKeyStoreFromBytes ¶
LoadKeyStoreFromBytes загружает PKCS12.
func (*Client) ValidateCertOCSP ¶
func (*Client) VerifyDetached ¶
VerifyDetached обеспечивает проверку отделенной подписи CMS (detached signature) в base64.
func (*Client) X509CertificateGetInfo ¶
type Kalkan ¶
type Kalkan interface {
LoadKeyStore(path, password string) (err error)
LoadKeyStoreFromBytes(key []byte, password string) (err error)
Sign(data []byte, isDetached, withTSP bool) (signature []byte, err error)
SignXML(xml string) (signedXML string, err error)
SignWSSE(xml, id string) (signedXML string, err error)
Verify(signature []byte) (string, error)
VerifyXML(signedXML string) (string, error)
VerifyDetached(signature, data []byte) (string, error)
GetCertFromCMS(cms []byte, signID int) (string, error)
GetCertFromXML(xml string, signID int) ([]byte, error)
ValidateCert(cert string) (string, error)
ValidateCertOCSP(cert string, url ...string) (string, error)
X509CertificateGetInfo(inCert string, prop ckalkan.CertProp) (string, error)
HashSHA256(data []byte) ([]byte, error)
HashGOST95(data []byte) ([]byte, error)
Close() error
}
Kalkan - это обертка над методами KalkanCrypt.
type Option ¶
type Option func(o *Options)
func WithCerts ¶
func WithCerts(c []OptionsCert) Option
func WithLogger ¶
func WithRemoteProdCerts ¶
func WithRemoteTestCerts ¶
type Options ¶
type Options struct {
TSP string `json:"tsp"` // URL метки времени
OCSP string `json:"ocsp"` // URL сервиса онлайн проверки статуса сертификата
Certs []OptionsCert `json:"certs"` // Корневые сертификатам
LoadCerts bool `json:"load_certs"`
// contains filtered or unexported fields
}
type OptionsCert ¶
type OptionsCert struct {
Cert *x509.Certificate
Type ckalkan.CertType
}
type Summary ¶
type Summary struct {
Type CertType
Subject CertSubject
Organization *CertOrganization
Issuer CertIssuer
PublicKey string
SerialNumber string
NotAfter time.Time
NotBefore time.Time
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.