diff --git a/api/utils/keys/alias.go b/api/utils/keys/alias.go deleted file mode 100644 index 8323a9c9e53ff..0000000000000 --- a/api/utils/keys/alias.go +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright 2025 Gravitational, Inc. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package keys - -import "github.com/gravitational/teleport/api/utils/keys/hardwarekey" - -// Temporary aliases for types moved to the hardwarekey or piv packages -// TODO(Joerger): Remove once /e no longer relies on them. - -// AttestationStatement is an attestation statement for a hardware private key -// that supports json marshaling through the standard json/encoding package. -type AttestationStatement = hardwarekey.AttestationStatement - -// AttestationStatementFromProto converts an AttestationStatement from its protobuf form. -var AttestationStatementFromProto = hardwarekey.AttestationStatementFromProto diff --git a/api/utils/keys/policy_piv.go b/api/utils/keys/policy_piv.go deleted file mode 100644 index 43b76aaad534e..0000000000000 --- a/api/utils/keys/policy_piv.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build piv && !pivtest - -/* -Copyright 2025 Gravitational, Inc. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package keys - -import ( - "github.com/go-piv/piv-go/v2/piv" -) - -// GetPrivateKeyPolicyFromAttestation returns the PrivateKeyPolicy satisfied by the given hardware key attestation. -// TODO(Joerger): Move to /e where this is used. -func GetPrivateKeyPolicyFromAttestation(att *piv.Attestation) PrivateKeyPolicy { - if att == nil { - return PrivateKeyPolicyNone - } - - isTouchPolicy := att.TouchPolicy == piv.TouchPolicyCached || - att.TouchPolicy == piv.TouchPolicyAlways - - isPINPolicy := att.PINPolicy == piv.PINPolicyOnce || - att.PINPolicy == piv.PINPolicyAlways - - switch { - case isPINPolicy && isTouchPolicy: - return PrivateKeyPolicyHardwareKeyTouchAndPIN - case isPINPolicy: - return PrivateKeyPolicyHardwareKeyPIN - case isTouchPolicy: - return PrivateKeyPolicyHardwareKeyTouch - default: - return PrivateKeyPolicyHardwareKey - } -}