@@ -15,8 +15,29 @@ public enum ParsecRsaSignature implements ParsecSignatureInfo {
15
15
pkcs1WithHash (PsaAlgorithm .Algorithm .Hash .SHA_512 ),
16
16
() -> MessageDigest .getInstance ("SHA-512" )),
17
17
SHA256_WITH_RSA ("SHA256withRSA" ,
18
- pkcs1WithHash (PsaAlgorithm .Algorithm .Hash .SHA_256 ),
19
- () -> MessageDigest .getInstance ("SHA-256" )),
18
+ pkcs1WithHash (PsaAlgorithm .Algorithm .Hash .SHA_256 ),
19
+ () -> MessageDigest .getInstance ("SHA-256" )),
20
+ NONE_WITH_RSA ("NONEwithRSA" ,
21
+ pkcs1 (),
22
+ () -> new MessageDigest ("NONE" ){
23
+ byte input0 ;
24
+ byte [] input1 ;
25
+ @ Override
26
+ protected void engineUpdate (byte input ) {
27
+ this .input0 = input ;
28
+ }
29
+
30
+ @ Override
31
+ protected void engineUpdate (byte [] input , int offset , int len ) {
32
+ this .input1 = input ;
33
+ }
34
+
35
+ @ Override
36
+ protected byte [] engineDigest () {return input1 ;}
37
+
38
+ @ Override
39
+ protected void engineReset () {}
40
+ }),
20
41
21
42
;
22
43
@@ -26,12 +47,19 @@ public enum ParsecRsaSignature implements ParsecSignatureInfo {
26
47
27
48
private static AsymmetricSignature pkcs1WithHash (PsaAlgorithm .Algorithm .Hash hash ) {
28
49
return AsymmetricSignature .newBuilder ()
29
- .setRsaPkcs1V15Sign (AsymmetricSignature .RsaPkcs1v15Sign .newBuilder ()
30
- .setHashAlg (AsymmetricSignature .SignHash .newBuilder ()
31
- .setSpecific (hash )
32
- .build ())
33
- .build ())
34
- .build ();
50
+ .setRsaPkcs1V15Sign (AsymmetricSignature .RsaPkcs1v15Sign .newBuilder ()
51
+ .setHashAlg (AsymmetricSignature .SignHash .newBuilder ()
52
+ .setSpecific (hash )
53
+ .build ())
54
+ .build ())
55
+ .build ();
56
+ }
57
+
58
+ private static AsymmetricSignature pkcs1 () {
59
+ return AsymmetricSignature .newBuilder ()
60
+ .setRsaPkcs1V15Sign (AsymmetricSignature .RsaPkcs1v15Sign .newBuilder ()
61
+ .build ())
62
+ .build ();
35
63
}
36
64
37
65
@ Override
0 commit comments