github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/bccsp/pkcs11/conf.go (about) 1 /* 2 Copyright hechain. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package pkcs11 8 9 import "time" 10 11 const ( 12 defaultCreateSessionRetries = 10 13 defaultCreateSessionRetryDelay = 100 * time.Millisecond 14 defaultSessionCacheSize = 10 15 ) 16 17 // PKCS11Opts contains options for the P11Factory 18 type PKCS11Opts struct { 19 // Default algorithms when not specified (Deprecated?) 20 Security int `json:"security"` 21 Hash string `json:"hash"` 22 23 // PKCS11 options 24 Library string `json:"library"` 25 Label string `json:"label"` 26 Pin string `json:"pin"` 27 SoftwareVerify bool `json:"softwareverify,omitempty"` 28 Immutable bool `json:"immutable,omitempty"` 29 AltID string `json:"altid,omitempty"` 30 KeyIDs []KeyIDMapping `json:"keyids,omitempty" mapstructure:"keyids"` 31 32 sessionCacheSize int 33 createSessionRetries int 34 createSessionRetryDelay time.Duration 35 } 36 37 // A KeyIDMapping associates the CKA_ID attribute of a cryptoki object with a 38 // subject key identifer. 39 type KeyIDMapping struct { 40 SKI string `json:"ski,omitempty"` 41 ID string `json:"id,omitempty"` 42 }