@@ -38,9 +38,13 @@ func TestSignerKeyManagerGetPrimitiveBasic(t *testing.T) {
3838 instance tinkmldsa.Instance
3939 }{
4040 {
41- name : "MLDSA65 " ,
41+ name : "ML-DSA-65 " ,
4242 instance : tinkmldsa .MLDSA65 ,
4343 },
44+ {
45+ name : "ML-DSA-87" ,
46+ instance : tinkmldsa .MLDSA87 ,
47+ },
4448 } {
4549 t .Run (tc .name , func (t * testing.T ) {
4650 km , err := registry .GetKeyManager ("type.googleapis.com/google.crypto.tink.MlDsaPrivateKey" )
@@ -108,9 +112,13 @@ func TestSignerKeyManagerGetPrimitiveWithInvalidInput(t *testing.T) {
108112 instance mldsapb.MlDsaInstance
109113 }{
110114 {
111- name : "MLDSA65 " ,
115+ name : "ML-DSA-65 " ,
112116 instance : mldsapb .MlDsaInstance_ML_DSA_65 ,
113117 },
118+ {
119+ name : "ML-DSA-87" ,
120+ instance : mldsapb .MlDsaInstance_ML_DSA_87 ,
121+ },
114122 } {
115123 t .Run (tc .name , func (t * testing.T ) {
116124 key := newMLDSAPrivateKey (tc .instance )
@@ -139,9 +147,13 @@ func TestSignerKeyManagerNewKeyDataBasic(t *testing.T) {
139147 instance mldsapb.MlDsaInstance
140148 }{
141149 {
142- name : "MLDSA65 " ,
150+ name : "ML-DSA-65 " ,
143151 instance : mldsapb .MlDsaInstance_ML_DSA_65 ,
144152 },
153+ {
154+ name : "ML-DSA-87" ,
155+ instance : mldsapb .MlDsaInstance_ML_DSA_87 ,
156+ },
145157 } {
146158 t .Run (tc .name , func (t * testing.T ) {
147159 km , err := registry .GetKeyManager ("type.googleapis.com/google.crypto.tink.MlDsaPrivateKey" )
@@ -179,9 +191,13 @@ func TestSignerKeyManagerPublicKeyDataBasic(t *testing.T) {
179191 instance mldsapb.MlDsaInstance
180192 }{
181193 {
182- name : "MLDSA65 " ,
194+ name : "ML-DSA-65 " ,
183195 instance : mldsapb .MlDsaInstance_ML_DSA_65 ,
184196 },
197+ {
198+ name : "ML-DSA-87" ,
199+ instance : mldsapb .MlDsaInstance_ML_DSA_87 ,
200+ },
185201 } {
186202 t .Run (tc .name , func (t * testing.T ) {
187203 km , err := registry .GetKeyManager ("type.googleapis.com/google.crypto.tink.MlDsaPrivateKey" )
@@ -223,9 +239,13 @@ func TestSignerKeyManagerPublicKeyDataWithInvalidInput(t *testing.T) {
223239 instance mldsapb.MlDsaInstance
224240 }{
225241 {
226- name : "MLDSA65 " ,
242+ name : "ML-DSA-65 " ,
227243 instance : mldsapb .MlDsaInstance_ML_DSA_65 ,
228244 },
245+ {
246+ name : "ML-DSA-87" ,
247+ instance : mldsapb .MlDsaInstance_ML_DSA_87 ,
248+ },
229249 } {
230250 t .Run (tc .name , func (t * testing.T ) {
231251 km , err := registry .GetKeyManager ("type.googleapis.com/google.crypto.tink.MlDsaPrivateKey" )
@@ -271,6 +291,21 @@ func newMLDSAPrivateKey(instance mldsapb.MlDsaInstance) *mldsapb.MlDsaPrivateKey
271291 PublicKey : publicProto ,
272292 KeyValue : seed [:],
273293 }
294+ case mldsapb .MlDsaInstance_ML_DSA_87 :
295+ public , private := mldsa .MLDSA87 .KeyGen ()
296+ publicProto := & mldsapb.MlDsaPublicKey {
297+ Params : & mldsapb.MlDsaParams {
298+ MlDsaInstance : mldsapb .MlDsaInstance_ML_DSA_87 ,
299+ },
300+ Version : 0 ,
301+ KeyValue : public .Encode (),
302+ }
303+ seed := private .Seed ()
304+ return & mldsapb.MlDsaPrivateKey {
305+ Version : 0 ,
306+ PublicKey : publicProto ,
307+ KeyValue : seed [:],
308+ }
274309 default :
275310 panic (fmt .Sprintf ("Unsupported MLDSA instance: %v" , instance ))
276311 }
@@ -294,6 +329,8 @@ func validateMLDSAPrivateKey(instance mldsapb.MlDsaInstance, key *mldsapb.MlDsaP
294329 switch instance {
295330 case mldsapb .MlDsaInstance_ML_DSA_65 :
296331 pub , _ = mldsa .MLDSA65 .KeyGenFromSeed (seedBytes )
332+ case mldsapb .MlDsaInstance_ML_DSA_87 :
333+ pub , _ = mldsa .MLDSA87 .KeyGenFromSeed (seedBytes )
297334 default :
298335 return fmt .Errorf ("unsupported instance: %v" , instance )
299336 }
0 commit comments