Skip to content

Commit cb8c0c0

Browse files
authored
fix(kmip): fix CryptographicAlgorithm xml names (#40)
BREAKING CHANGE: rename CryptographicAlgorithm TDES to 3DES Signed-off-by: Pierre-Henri Symoneaux <[email protected]>
1 parent e7b0205 commit cb8c0c0

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

enums.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,17 @@ func init() {
9090
})
9191
ttlv.RegisterEnum(TagCryptographicAlgorithm, map[CryptographicAlgorithm]string{
9292
CryptographicAlgorithmDES: "DES",
93-
CryptographicAlgorithmTDES: "TDES",
93+
CryptographicAlgorithm3DES: "DES3",
9494
CryptographicAlgorithmAES: "AES",
9595
CryptographicAlgorithmRSA: "RSA",
9696
CryptographicAlgorithmDSA: "DSA",
9797
CryptographicAlgorithmECDSA: "ECDSA",
98-
CryptographicAlgorithmHMACSHA1: "HMACSHA1",
99-
CryptographicAlgorithmHMACSHA224: "HMACSHA224",
100-
CryptographicAlgorithmHMACSHA256: "HMACSHA256",
101-
CryptographicAlgorithmHMACSHA384: "HMACSHA384",
102-
CryptographicAlgorithmHMACSHA512: "HMACSHA512",
103-
CryptographicAlgorithmHMACMD5: "HMACMD5",
98+
CryptographicAlgorithmHMACSHA1: "HMAC_SHA1",
99+
CryptographicAlgorithmHMACSHA224: "HMAC_SHA224",
100+
CryptographicAlgorithmHMACSHA256: "HMAC_SHA256",
101+
CryptographicAlgorithmHMACSHA384: "HMAC_SHA384",
102+
CryptographicAlgorithmHMACSHA512: "HMAC_SHA512",
103+
CryptographicAlgorithmHMACMD5: "HMAC_MD5",
104104
CryptographicAlgorithmDH: "DH",
105105
CryptographicAlgorithmECDH: "ECDH",
106106
CryptographicAlgorithmECMQV: "ECMQV",
@@ -816,7 +816,7 @@ type CryptographicAlgorithm uint32
816816

817817
const (
818818
CryptographicAlgorithmDES CryptographicAlgorithm = 0x00000001
819-
CryptographicAlgorithmTDES CryptographicAlgorithm = 0x00000002
819+
CryptographicAlgorithm3DES CryptographicAlgorithm = 0x00000002
820820
CryptographicAlgorithmAES CryptographicAlgorithm = 0x00000003
821821
CryptographicAlgorithmRSA CryptographicAlgorithm = 0x00000004
822822
CryptographicAlgorithmDSA CryptographicAlgorithm = 0x00000005

kmipclient/create.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func (ex ExecCreateWantType) Object(objectType kmip.ObjectType, attrs ...kmip.At
5757
// the object type to SymmetricKey and attaches the relevant cryptographic attributes.
5858
//
5959
// Parameters:
60-
// - alg: The cryptographic algorithm to use for the symmetric key (e.g., AES, TDES).
60+
// - alg: The cryptographic algorithm to use for the symmetric key (e.g., AES, 3DES).
6161
// - length: The length of the key in bits. Must be between 0 and math.MaxInt32.
6262
// - usage: The intended usage mask for the key (bitmask of allowed operations).
6363
//
@@ -95,23 +95,23 @@ func (ex ExecCreateWantType) AES(length int, usage kmip.CryptographicUsageMask)
9595
return ex.SymmetricKey(kmip.CryptographicAlgorithmAES, length, usage)
9696
}
9797

98-
// TDES creates a symmetric key using the Triple DES (TDES) cryptographic algorithm with the specified key length and usage mask.
99-
// It returns an ExecCreate configured for TDES key creation.
98+
// TDES creates a symmetric key using the 3DES cryptographic algorithm with the specified key length and usage mask.
99+
// It returns an ExecCreate configured for 3DES key creation.
100100
//
101101
// Parameters:
102-
// - length: The length of the TDES key in bits.
102+
// - length: The length of the 3DES key in bits.
103103
// - usage: The intended cryptographic usage mask for the key.
104104
//
105105
// Returns:
106-
// - ExecCreate: An instance configured for TDES key creation.
106+
// - ExecCreate: An instance configured for 3DES key creation.
107107
//
108-
// Deprecated: TDES is considered insecure and shouldn't be used.
108+
// Deprecated: 3DES is considered insecure and shouldn't be used.
109109
//
110110
// Errors:
111111
// - Panics if length is negative or exceeds math.MaxInt32.
112112
// - Errors may be returned when executing the operation if the server does not support the requested key length.
113113
func (ex ExecCreateWantType) TDES(length int, usage kmip.CryptographicUsageMask) ExecCreate {
114-
return ex.SymmetricKey(kmip.CryptographicAlgorithmTDES, length, usage)
114+
return ex.SymmetricKey(kmip.CryptographicAlgorithm3DES, length, usage)
115115
}
116116

117117
// Skipjack creates a symmetric key with the SKIPJACK cryptographic algorithm and a key length of 80 bits.

0 commit comments

Comments
 (0)