@@ -33,22 +33,22 @@ String _rsaPssJwkAlgFromHash(_Hash hash) {
33
33
throw UnsupportedError ('hash is not supported' );
34
34
}
35
35
36
- Future <RsaPssPrivateKey > rsaPssPrivateKey_importPkcs8Key (
36
+ Future <RsaPssPrivateKeyImpl > rsaPssPrivateKey_importPkcs8Key (
37
37
List <int > keyData,
38
38
Hash hash,
39
39
) async {
40
40
// Validate and get hash function
41
41
final h = _Hash .fromHash (hash);
42
- return _RsaPssPrivateKey (_importPkcs8RsaPrivateKey (keyData), h);
42
+ return _RsaPssPrivateKeyImpl (_importPkcs8RsaPrivateKey (keyData), h);
43
43
}
44
44
45
- Future <RsaPssPrivateKey > rsaPssPrivateKey_importJsonWebKey (
45
+ Future <RsaPssPrivateKeyImpl > rsaPssPrivateKey_importJsonWebKey (
46
46
Map <String , dynamic > jwk,
47
47
Hash hash,
48
48
) async {
49
49
// Validate and get hash function
50
50
final h = _Hash .fromHash (hash);
51
- return _RsaPssPrivateKey (
51
+ return _RsaPssPrivateKeyImpl (
52
52
_importJwkRsaPrivateOrPublicKey (
53
53
JsonWebKey .fromJson (jwk),
54
54
isPrivateKey: true ,
@@ -59,7 +59,8 @@ Future<RsaPssPrivateKey> rsaPssPrivateKey_importJsonWebKey(
59
59
);
60
60
}
61
61
62
- Future <KeyPair <RsaPssPrivateKey , RsaPssPublicKey >> rsaPssPrivateKey_generateKey (
62
+ Future <KeyPair <RsaPssPrivateKeyImpl , RsaPssPublicKeyImpl >>
63
+ rsaPssPrivateKey_generateKey (
63
64
int modulusLength,
64
65
BigInt publicExponent,
65
66
Hash hash,
@@ -68,27 +69,27 @@ Future<KeyPair<RsaPssPrivateKey, RsaPssPublicKey>> rsaPssPrivateKey_generateKey(
68
69
final h = _Hash .fromHash (hash);
69
70
final keys = _generateRsaKeyPair (modulusLength, publicExponent);
70
71
return createKeyPair (
71
- _RsaPssPrivateKey (keys.privateKey, h),
72
- _RsaPssPublicKey (keys.publicKey, h),
72
+ _RsaPssPrivateKeyImpl (keys.privateKey, h),
73
+ _RsaPssPublicKeyImpl (keys.publicKey, h),
73
74
);
74
75
}
75
76
76
- Future <RsaPssPublicKey > rsaPssPublicKey_importSpkiKey (
77
+ Future <RsaPssPublicKeyImpl > rsaPssPublicKey_importSpkiKey (
77
78
List <int > keyData,
78
79
Hash hash,
79
80
) async {
80
81
// Validate and get hash function
81
82
final h = _Hash .fromHash (hash);
82
- return _RsaPssPublicKey (_importSpkiRsaPublicKey (keyData), h);
83
+ return _RsaPssPublicKeyImpl (_importSpkiRsaPublicKey (keyData), h);
83
84
}
84
85
85
- Future <RsaPssPublicKey > rsaPssPublicKey_importJsonWebKey (
86
+ Future <RsaPssPublicKeyImpl > rsaPssPublicKey_importJsonWebKey (
86
87
Map <String , dynamic > jwk,
87
88
Hash hash,
88
89
) async {
89
90
// Validate and get hash function
90
91
final h = _Hash .fromHash (hash);
91
- return _RsaPssPublicKey (
92
+ return _RsaPssPublicKeyImpl (
92
93
_importJwkRsaPrivateOrPublicKey (
93
94
JsonWebKey .fromJson (jwk),
94
95
isPrivateKey: false ,
@@ -99,11 +100,43 @@ Future<RsaPssPublicKey> rsaPssPublicKey_importJsonWebKey(
99
100
);
100
101
}
101
102
102
- class _RsaPssPrivateKey implements RsaPssPrivateKey {
103
+ final class _StaticRsaPssPrivateKeyImpl implements StaticRsaPssPrivateKeyImpl {
104
+ const _StaticRsaPssPrivateKeyImpl ();
105
+
106
+ @override
107
+ Future <RsaPssPrivateKeyImpl > importPkcs8Key (
108
+ List <int > keyData,
109
+ Hash hash,
110
+ ) async {
111
+ return await rsaPssPrivateKey_importPkcs8Key (keyData, hash);
112
+ }
113
+
114
+ @override
115
+ Future <RsaPssPrivateKeyImpl > importJsonWebKey (
116
+ Map <String , dynamic > jwk,
117
+ Hash hash,
118
+ ) async {
119
+ return await rsaPssPrivateKey_importJsonWebKey (jwk, hash);
120
+ }
121
+
122
+ @override
123
+ Future <(RsaPssPrivateKeyImpl , RsaPssPublicKeyImpl )> generateKey (
124
+ int modulusLength,
125
+ BigInt publicExponent,
126
+ Hash hash,
127
+ ) async {
128
+ final KeyPair <RsaPssPrivateKeyImpl , RsaPssPublicKeyImpl > keyPair =
129
+ await rsaPssPrivateKey_generateKey (modulusLength, publicExponent, hash);
130
+
131
+ return (keyPair.privateKey, keyPair.publicKey);
132
+ }
133
+ }
134
+
135
+ final class _RsaPssPrivateKeyImpl implements RsaPssPrivateKeyImpl {
103
136
final _EvpPKey _key;
104
137
final _Hash _hash;
105
138
106
- _RsaPssPrivateKey (this ._key, this ._hash);
139
+ _RsaPssPrivateKeyImpl (this ._key, this ._hash);
107
140
108
141
@override
109
142
String toString () {
@@ -148,11 +181,31 @@ class _RsaPssPrivateKey implements RsaPssPrivateKey {
148
181
Future <Uint8List > exportPkcs8Key () async => _exportPkcs8Key (_key);
149
182
}
150
183
151
- class _RsaPssPublicKey implements RsaPssPublicKey {
184
+ final class _StaticRsaPssPublicKeyImpl implements StaticRsaPssPublicKeyImpl {
185
+ const _StaticRsaPssPublicKeyImpl ();
186
+
187
+ @override
188
+ Future <RsaPssPublicKeyImpl > importSpkiKey (
189
+ List <int > keyData,
190
+ Hash hash,
191
+ ) async {
192
+ return await rsaPssPublicKey_importSpkiKey (keyData, hash);
193
+ }
194
+
195
+ @override
196
+ Future <RsaPssPublicKeyImpl > importJsonWebKey (
197
+ Map <String , dynamic > jwk,
198
+ Hash hash,
199
+ ) async {
200
+ return await rsaPssPublicKey_importJsonWebKey (jwk, hash);
201
+ }
202
+ }
203
+
204
+ final class _RsaPssPublicKeyImpl implements RsaPssPublicKeyImpl {
152
205
final _EvpPKey _key;
153
206
final _Hash _hash;
154
207
155
- _RsaPssPublicKey (this ._key, this ._hash);
208
+ _RsaPssPublicKeyImpl (this ._key, this ._hash);
156
209
157
210
@override
158
211
String toString () {
0 commit comments