Documentation
¶
Index ¶
- Variables
- type Cert
- type Client
- func (c *Client) NodeInfo() (*NodeInfoResponse, error)
- func (c *Client) PKCS12Info(p12, password string, verifyOCSP, verifyCRL bool) (*X509Response, error)
- func (c *Client) RawSign(p12, password, raw string, config *TSPConfig) (*RawSignResponse, error)
- func (c *Client) RawVerify(cms string, verifyOCSP, verifyCRL bool) (*RawVerifyResponse, error)
- func (c *Client) TSPSign(raw string, policy Policy, alg HashAlgorithm) (*TSPSignResponse, error)
- func (c *Client) TSPVerify(cms string) (*TSPVerifyResponse, error)
- func (c *Client) X509Info(cert string, verifyOCSP, verifyCRL bool) (*X509Response, error)
- func (c *Client) XMLSign(p12, password, xml string, config *TSPConfig) (*XMLSignResponse, error)
- func (c *Client) XMLVerify(xml string, verifyOCSP, verifyCRL bool) (*XMLVerifyResponse, error)
- type Gender
- type HashAlgorithm
- type KeyUsage
- type KeyUser
- type NodeInfoResponse
- type Option
- type Policy
- type RawSignResponse
- type RawVerifyResponse
- type Revocation
- type Status
- type Subject
- type TSPConfig
- type TSPSignResponse
- type TSPVerifyResponse
- type Time
- type X509Response
- type XMLSignResponse
- type XMLVerifyResponse
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidRequestBody is returned if input parameters of client method has // not enough or empty values. ErrInvalidRequestBody = errors.New("ncanode: invalid request body") // ErrFailedConnection is returned if host is not available. ErrFailedConnection = errors.New("ncanode: connection failed") )
Functions ¶
This section is empty.
Types ¶
type Cert ¶
type Cert struct { Valid bool `json:"valid"` NotAfter Time `json:"notAfter"` NotBefore Time `json:"notBefore"` Chain []X509Response `json:"chain"` KeyUsage KeyUsage `json:"keyUsage"` SerialNumber string `json:"serialNumber"` Subject Subject `json:"subject"` SignAlg string `json:"signAlg"` Sign string `json:"sign"` PublicKey string `json:"publicKey"` Issuer Subject `json:"issuer"` KeyUser []KeyUser `json:"keyUser"` OCSP *Revocation `json:"ocsp"` CRL *Revocation `json:"crl"` }
Cert holds data of certificate.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is API client.
func (*Client) NodeInfo ¶
func (c *Client) NodeInfo() (*NodeInfoResponse, error)
NodeInfo returns NCANode server stats.
See https://ncanode.kz/docs.php?go=d8324d275a38b9c386071731e33afcaee4db7b50
func (*Client) PKCS12Info ¶
func (c *Client) PKCS12Info(p12, password string, verifyOCSP, verifyCRL bool) (*X509Response, error)
PKCS12Info returns P12 container info.
See https://ncanode.kz/docs.php?go=9797704344e3175efb3260fbc5e58dac6c2fed3d
func (*Client) RawSign ¶
func (c *Client) RawSign(p12, password, raw string, config *TSPConfig) (*RawSignResponse, error)
RawSign signs any input string and saves into cms.
See https://ncanode.kz/docs.php?go=b52dfc5eddafafb5d7c8cccb06c5f0e011a27f3d
func (*Client) RawVerify ¶
func (c *Client) RawVerify(cms string, verifyOCSP, verifyCRL bool) (*RawVerifyResponse, error)
RawVerify validates cms signature.
See https://ncanode.kz/docs.php?go=3f85fac8fa2729687ed307e791ce0fb17d704e26
func (*Client) TSPSign ¶
func (c *Client) TSPSign(raw string, policy Policy, alg HashAlgorithm) (*TSPSignResponse, error)
TSPSign signs any input string using TSP.
See https://ncanode.kz/docs.php?go=366ea24993a9887051c5f647f8dba8fa5e236d58
func (*Client) TSPVerify ¶
func (c *Client) TSPVerify(cms string) (*TSPVerifyResponse, error)
TSPVerify validates tsp signature.
See https://ncanode.kz/docs.php?go=c2e4ebcfdb0ce789aa3f985ad96d1d223c835284
func (*Client) X509Info ¶
func (c *Client) X509Info(cert string, verifyOCSP, verifyCRL bool) (*X509Response, error)
X509Info returns certifacate info.
See https://ncanode.kz/docs.php?go=68c0077b854fcdb23c567751b1329be3a34447c0
func (*Client) XMLSign ¶
func (c *Client) XMLSign(p12, password, xml string, config *TSPConfig) (*XMLSignResponse, error)
XMLSign signs xml.
See https://ncanode.kz/docs.php?go=7025fdf95d235db4bc6985efd3d1574214107cfd
func (*Client) XMLVerify ¶
func (c *Client) XMLVerify(xml string, verifyOCSP, verifyCRL bool) (*XMLVerifyResponse, error)
XMLVerify validates xml signature.
See https://ncanode.kz/docs.php?go=50acb512216c279acfa7eeb6de6dc2592039bd83
type HashAlgorithm ¶
type HashAlgorithm string
HashAlgorithm is an alias of tsp hash algorithm.
const ( MD5 HashAlgorithm = "MD5" SHA1 HashAlgorithm = "SHA1" SHA224 HashAlgorithm = "SHA224" SHA256 HashAlgorithm = "SHA256" SHA384 HashAlgorithm = "SHA384" SHA512 HashAlgorithm = "SHA512" RIPEMD128 HashAlgorithm = "RIPEMD128" RIPEMD160 HashAlgorithm = "RIPEMD160" RIPEMD256 HashAlgorithm = "RIPEMD256" GOST34311GT HashAlgorithm = "GOST34311GT" GOST34311 HashAlgorithm = "GOST34311" )
List of values HashAlgorithm can take.
type KeyUser ¶
type KeyUser string
KeyUser is an alias of user type.
const ( KeyUserIndividual KeyUser = "INDIVIDUAL" KeyUserOrganization KeyUser = "ORGANIZATION" KeyUserCEO KeyUser = "CEO" KeyUserCanSign KeyUser = "CAN_SIGN" KeyUserCanSignFinancial KeyUser = "CAN_SIGN_FINANCIAL" KeyUserHR KeyUser = "HR" KeyUserEmployee KeyUser = "EMPLOYEE" KeyUserNCAPrivileges KeyUser = "NCA_PRIVILEGES" KeyUserNCAAdmin KeyUser = "NCA_ADMIN" KeyUserNCAManager KeyUser = "NCA_MANAGER" KeyUserNCAOperator KeyUser = "NCA_OPERATOR" )
List of values KeyUser can take.
type NodeInfoResponse ¶
type NodeInfoResponse struct { Result struct { Datetime Time `json:"dateTime"` Timezone string `json:"timezone"` Name string `json:"name"` Version string `json:"version"` } `json:"result"` // contains filtered or unexported fields }
NodeInfoResponse describes json response from NodeInfo.
type Option ¶
Option changes client properties.
func WithHTTPClient ¶
WithHTTPClient sets own http client.
func WithTimeout ¶
WithTimeout sets http client timeout by given duration.
type RawSignResponse ¶
type RawSignResponse struct { Result struct { CMS string `json:"cms"` TSP string `json:"tsp,omitempty"` } `json:"result"` // contains filtered or unexported fields }
RawSignResponse describes json response from RawSign.
type RawVerifyResponse ¶
type RawVerifyResponse struct { Result struct { Valid bool `json:"valid"` Cert Cert `json:"cert"` } `json:"result"` // contains filtered or unexported fields }
RawVerifyResponse describes json response from RawVerify.
type Revocation ¶
type Revocation struct { Reason interface{} `json:"revokationReason"` Time Time `json:"revokationTime"` RevokedBy string `json:"revokedBy,omitempty"` Status Status `json:"status"` }
Revocation holds data of revoked certificate.
type Subject ¶
type Subject struct { LastName string `json:"lastName,omitempty"` Country string `json:"country,omitempty"` CommonName string `json:"commonName,omitempty"` Gender Gender `json:"gender,omitempty"` Surname string `json:"surname,omitempty"` Locality string `json:"locality,omitempty"` DN string `json:"dn,omitempty"` State string `json:"state,omitempty"` BirthDate string `json:"birthDate,omitempty"` IIN string `json:"iin,omitempty"` BIN string `json:"bin,omitempty"` Organization string `json:"organization,omitempty"` Email string `json:"email,omitempty"` }
Subject holds person or organization data.
type TSPConfig ¶
type TSPConfig struct { Enabled bool Policy Policy HashAlgorithm HashAlgorithm InCMS bool }
TSPConfig specifies TSP signing options. Used if Enabled is set to true.
type TSPSignResponse ¶
type TSPSignResponse struct { Result struct { TSP string `json:"tsp"` } `json:"result"` // contains filtered or unexported fields }
TSPSignResponse describes json response from TSPSign.
type TSPVerifyResponse ¶
type TSPVerifyResponse struct { Result struct { TSPHashAlgorithm HashAlgorithm `json:"tspHashAlgorithm"` SerialNumber string `json:"serialNumber"` GenTime Time `json:"genTime"` Hash string `json:"hash"` Policy string `json:"policy"` } `json:"result"` // contains filtered or unexported fields }
TSPVerifyResponse describes json response from TSPVerify.
type Time ¶
Time is a small wrapper of std time. Difference is time layout used by json decoding.
func (Time) MarshalJSON ¶
MarshalJSON implements custom marshaling of json encoder.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements custom unmarshaling of json decoder.
type X509Response ¶
type X509Response struct { Result Cert `json:"result"` // contains filtered or unexported fields }
X509Response describes json response from X509Info.
type XMLSignResponse ¶
type XMLSignResponse struct { Result struct { XML string `json:"xml"` TSP string `json:"tsp"` } `json:"result"` // contains filtered or unexported fields }
XMLSignResponse describes json response from XMLSign.
type XMLVerifyResponse ¶
type XMLVerifyResponse struct { Result struct { Valid bool `json:"valid"` Cert Cert `json:"cert"` } `json:"result"` // contains filtered or unexported fields }
XMLVerifyResponse describes json response from XMLVerify.