@@ -33,22 +33,22 @@ String _rsassaPkcs1V15JwkAlgFromHash(_Hash hash) {
33
33
throw UnsupportedError ('hash is not supported' );
34
34
}
35
35
36
- Future <RsassaPkcs1V15PrivateKey > rsassaPkcs1V15PrivateKey_importPkcs8Key (
36
+ Future <RsaSsaPkcs1V15PrivateKeyImpl > rsassaPkcs1V15PrivateKey_importPkcs8Key (
37
37
List <int > keyData,
38
38
Hash hash,
39
39
) async {
40
40
// Get hash first, to avoid a leak of EVP_PKEY if _Hash.fromHash throws
41
41
final h = _Hash .fromHash (hash);
42
- return _RsassaPkcs1V15PrivateKey (_importPkcs8RsaPrivateKey (keyData), h);
42
+ return _RsaSsaPkcs1V15PrivateKeyImpl (_importPkcs8RsaPrivateKey (keyData), h);
43
43
}
44
44
45
- Future <RsassaPkcs1V15PrivateKey > rsassaPkcs1V15PrivateKey_importJsonWebKey (
45
+ Future <RsaSsaPkcs1V15PrivateKeyImpl > rsassaPkcs1V15PrivateKey_importJsonWebKey (
46
46
Map <String , dynamic > jwk,
47
47
Hash hash,
48
48
) async {
49
49
// Get hash first, to avoid a leak of EVP_PKEY if _Hash.fromHash throws
50
50
final h = _Hash .fromHash (hash);
51
- return _RsassaPkcs1V15PrivateKey (
51
+ return _RsaSsaPkcs1V15PrivateKeyImpl (
52
52
_importJwkRsaPrivateOrPublicKey (
53
53
JsonWebKey .fromJson (jwk),
54
54
isPrivateKey: true ,
@@ -59,7 +59,7 @@ Future<RsassaPkcs1V15PrivateKey> rsassaPkcs1V15PrivateKey_importJsonWebKey(
59
59
);
60
60
}
61
61
62
- Future <KeyPair <RsassaPkcs1V15PrivateKey , RsassaPkcs1V15PublicKey >>
62
+ Future <KeyPair <RsaSsaPkcs1V15PrivateKeyImpl , RsaSsaPkcs1V15PublicKeyImpl >>
63
63
rsassaPkcs1V15PrivateKey_generateKey (
64
64
int modulusLength,
65
65
BigInt publicExponent,
@@ -69,27 +69,27 @@ Future<KeyPair<RsassaPkcs1V15PrivateKey, RsassaPkcs1V15PublicKey>>
69
69
final h = _Hash .fromHash (hash);
70
70
final keys = _generateRsaKeyPair (modulusLength, publicExponent);
71
71
return createKeyPair (
72
- _RsassaPkcs1V15PrivateKey (keys.privateKey, h),
73
- _RsassaPkcs1V15PublicKey (keys.publicKey, h),
72
+ _RsaSsaPkcs1V15PrivateKeyImpl (keys.privateKey, h),
73
+ _RsaSsaPkcs1V15PublicKeyImpl (keys.publicKey, h),
74
74
);
75
75
}
76
76
77
- Future <RsassaPkcs1V15PublicKey > rsassaPkcs1V15PublicKey_importSpkiKey (
77
+ Future <RsaSsaPkcs1V15PublicKeyImpl > rsassaPkcs1V15PublicKey_importSpkiKey (
78
78
List <int > keyData,
79
79
Hash hash,
80
80
) async {
81
81
// Get hash first, to avoid a leak of EVP_PKEY if _Hash.fromHash throws
82
82
final h = _Hash .fromHash (hash);
83
- return _RsassaPkcs1V15PublicKey (_importSpkiRsaPublicKey (keyData), h);
83
+ return _RsaSsaPkcs1V15PublicKeyImpl (_importSpkiRsaPublicKey (keyData), h);
84
84
}
85
85
86
- Future <RsassaPkcs1V15PublicKey > rsassaPkcs1V15PublicKey_importJsonWebKey (
86
+ Future <RsaSsaPkcs1V15PublicKeyImpl > rsassaPkcs1V15PublicKey_importJsonWebKey (
87
87
Map <String , dynamic > jwk,
88
88
Hash hash,
89
89
) async {
90
90
// Get hash first, to avoid a leak of EVP_PKEY if _Hash.fromHash throws
91
91
final h = _Hash .fromHash (hash);
92
- return _RsassaPkcs1V15PublicKey (
92
+ return _RsaSsaPkcs1V15PublicKeyImpl (
93
93
_importJwkRsaPrivateOrPublicKey (
94
94
JsonWebKey .fromJson (jwk),
95
95
isPrivateKey: false ,
@@ -100,11 +100,45 @@ Future<RsassaPkcs1V15PublicKey> rsassaPkcs1V15PublicKey_importJsonWebKey(
100
100
);
101
101
}
102
102
103
- class _RsassaPkcs1V15PrivateKey implements RsassaPkcs1V15PrivateKey {
103
+ final class _StaticRsaSsaPkcs1V15PrivateKeyImpl
104
+ implements StaticRsaSsaPkcs1v15PrivateKeyImpl {
105
+ const _StaticRsaSsaPkcs1V15PrivateKeyImpl ();
106
+
107
+ @override
108
+ Future <RsaSsaPkcs1V15PrivateKeyImpl > importPkcs8Key (
109
+ List <int > keyData,
110
+ Hash hash,
111
+ ) =>
112
+ rsassaPkcs1V15PrivateKey_importPkcs8Key (keyData, hash);
113
+
114
+ @override
115
+ Future <RsaSsaPkcs1V15PrivateKeyImpl > importJsonWebKey (
116
+ Map <String , dynamic > jwk,
117
+ Hash hash,
118
+ ) =>
119
+ rsassaPkcs1V15PrivateKey_importJsonWebKey (jwk, hash);
120
+
121
+ @override
122
+ Future <(RsaSsaPkcs1V15PrivateKeyImpl , RsaSsaPkcs1V15PublicKeyImpl )>
123
+ generateKey (
124
+ int modulusLength,
125
+ BigInt publicExponent,
126
+ Hash hash,
127
+ ) async {
128
+ final KeyPair <RsaSsaPkcs1V15PrivateKeyImpl , RsaSsaPkcs1V15PublicKeyImpl >
129
+ pair = await rsassaPkcs1V15PrivateKey_generateKey (
130
+ modulusLength, publicExponent, hash);
131
+
132
+ return (pair.privateKey, pair.publicKey);
133
+ }
134
+ }
135
+
136
+ final class _RsaSsaPkcs1V15PrivateKeyImpl
137
+ implements RsaSsaPkcs1V15PrivateKeyImpl {
104
138
final _EvpPKey _key;
105
139
final _Hash _hash;
106
140
107
- _RsassaPkcs1V15PrivateKey (this ._key, this ._hash);
141
+ _RsaSsaPkcs1V15PrivateKeyImpl (this ._key, this ._hash);
108
142
109
143
@override
110
144
String toString () {
@@ -133,11 +167,27 @@ class _RsassaPkcs1V15PrivateKey implements RsassaPkcs1V15PrivateKey {
133
167
Future <Uint8List > exportPkcs8Key () async => _exportPkcs8Key (_key);
134
168
}
135
169
136
- class _RsassaPkcs1V15PublicKey implements RsassaPkcs1V15PublicKey {
170
+ final class _StaticRsaSsaPkcs1V15PublicKeyImpl
171
+ implements StaticRsaSsaPkcs1v15PublicKeyImpl {
172
+ const _StaticRsaSsaPkcs1V15PublicKeyImpl ();
173
+
174
+ @override
175
+ Future <RsaSsaPkcs1V15PublicKeyImpl > importSpkiKey (
176
+ List <int > keyData, Hash hash) =>
177
+ rsassaPkcs1V15PublicKey_importSpkiKey (keyData, hash);
178
+
179
+ @override
180
+ Future <RsaSsaPkcs1V15PublicKeyImpl > importJsonWebKey (
181
+ Map <String , dynamic > jwk, Hash hash) =>
182
+ rsassaPkcs1V15PublicKey_importJsonWebKey (jwk, hash);
183
+ }
184
+
185
+ final class _RsaSsaPkcs1V15PublicKeyImpl
186
+ implements RsaSsaPkcs1V15PublicKeyImpl {
137
187
final _EvpPKey _key;
138
188
final _Hash _hash;
139
189
140
- _RsassaPkcs1V15PublicKey (this ._key, this ._hash);
190
+ _RsaSsaPkcs1V15PublicKeyImpl (this ._key, this ._hash);
141
191
142
192
@override
143
193
Future <bool > verifyBytes (List <int > signature, List <int > data) =>
0 commit comments