@@ -54,10 +54,15 @@ const (
5454)
5555
5656const (
57- MachineStore = "machine"
58- UserStore = "user"
59- MyStore = "My"
60- CAStore = "CA" // TODO(hs): verify "CA" works for "machine" certs too
57+ MachineStoreLocation = "machine"
58+ UserStoreLocation = "user"
59+ MyStore = "My"
60+ CAStore = "CA" // TODO(hs): verify "CA" works for "machine" certs too
61+
62+ // Deprecated: use MachineStoreLocation
63+ MachineStore = MachineStoreLocation
64+ // Deprecated: use UserStoreLocation
65+ UserStore = UserStoreLocation
6166)
6267
6368// maximumIterations is the maximum number of times for the recursive
@@ -113,9 +118,9 @@ func parseURI(rawuri string) (*uriAttributes, error) {
113118 return & uriAttributes {
114119 ContainerName : u .Get (ContainerNameArg ),
115120 Hash : hashValue ,
116- StoreLocation : cmp .Or (u .Get (StoreLocationArg ), UserStore ),
121+ StoreLocation : cmp .Or (u .Get (StoreLocationArg ), UserStoreLocation ),
117122 StoreName : cmp .Or (u .Get (StoreNameArg ), MyStore ),
118- IntermediateStoreLocation : cmp .Or (u .Get (IntermediateStoreLocationArg ), UserStore ),
123+ IntermediateStoreLocation : cmp .Or (u .Get (IntermediateStoreLocationArg ), UserStoreLocation ),
119124 IntermediateStoreName : cmp .Or (u .Get (IntermediateStoreNameArg ), CAStore ),
120125 KeyID : keyIDValue ,
121126 SubjectCN : u .Get (SubjectCNArg ),
@@ -368,9 +373,9 @@ func (k *CAPIKMS) getCertContext(u *uriAttributes) (*windows.CertContext, error)
368373
369374 var certStoreLocation uint32
370375 switch u .StoreLocation {
371- case UserStore :
376+ case UserStoreLocation :
372377 certStoreLocation = certStoreCurrentUser
373- case MachineStore :
378+ case MachineStoreLocation :
374379 certStoreLocation = certStoreLocalMachine
375380 default :
376381 return nil , fmt .Errorf ("invalid cert store location %q" , u .StoreLocation )
@@ -750,16 +755,6 @@ func (k *CAPIKMS) LoadCertificateChain(req *apiv1.LoadCertificateChainRequest) (
750755 return nil , err
751756 }
752757
753- // Default to the user store location
754- if u .IntermediateStoreLocation == "" {
755- u .IntermediateStoreLocation = UserStore
756- }
757-
758- // Default to the CA store
759- if u .IntermediateStoreName == "" {
760- u .IntermediateStoreName = CAStore
761- }
762-
763758 chain := []* x509.Certificate {cert }
764759 child := cert
765760 for i := 0 ; i < maximumIterations ; i ++ { // loop a maximum number of times
@@ -806,9 +801,9 @@ func (k *CAPIKMS) StoreCertificate(req *apiv1.StoreCertificateRequest) error {
806801
807802 var certStoreLocation uint32
808803 switch u .StoreLocation {
809- case UserStore :
804+ case UserStoreLocation :
810805 certStoreLocation = certStoreCurrentUser
811- case MachineStore :
806+ case MachineStoreLocation :
812807 certStoreLocation = certStoreLocalMachine
813808 default :
814809 return fmt .Errorf ("invalid cert store location %q" , u .StoreLocation )
@@ -920,9 +915,9 @@ func (k *CAPIKMS) DeleteCertificate(req *apiv1.DeleteCertificateRequest) error {
920915
921916 var certStoreLocation uint32
922917 switch u .StoreLocation {
923- case UserStore :
918+ case UserStoreLocation :
924919 certStoreLocation = certStoreCurrentUser
925- case MachineStore :
920+ case MachineStoreLocation :
926921 certStoreLocation = certStoreLocalMachine
927922 default :
928923 return fmt .Errorf ("invalid cert store location %q" , u .StoreLocation )
@@ -1050,14 +1045,14 @@ func (k *CAPIKMS) getKeyFlags(u *uriAttributes) (uint32, error) {
10501045 keyFlags := uint32 (0 )
10511046
10521047 switch u .StoreLocation {
1053- case MachineStore :
1048+ case MachineStoreLocation :
10541049 if k .providerName == ProviderMSSC {
10551050 return 0 , fmt .Errorf ("machine store cannot be used with the %s" , ProviderMSSC )
10561051 }
10571052
10581053 keyFlags |= NCRYPT_MACHINE_KEY_FLAG
10591054
1060- case UserStore :
1055+ case UserStoreLocation :
10611056 if k .providerName == ProviderMSPCP {
10621057 return 0 , fmt .Errorf ("user store cannot be used with the %s" , ProviderMSPCP )
10631058 }
0 commit comments