@@ -110,6 +110,7 @@ This file is part of the iText (R) project.
110
110
import com .itextpdf .bouncycastle .cms .CMSExceptionBC ;
111
111
import com .itextpdf .bouncycastle .cms .jcajce .JcaSignerInfoGeneratorBuilderBC ;
112
112
import com .itextpdf .bouncycastle .cms .jcajce .JcaSimpleSignerInfoVerifierBuilderBC ;
113
+ import com .itextpdf .bouncycastle .cms .jcajce .JceKeyAgreeEnvelopedRecipientBC ;
113
114
import com .itextpdf .bouncycastle .cms .jcajce .JceKeyTransEnvelopedRecipientBC ;
114
115
import com .itextpdf .bouncycastle .openssl .PEMParserBC ;
115
116
import com .itextpdf .bouncycastle .openssl .jcajce .JcaPEMKeyConverterBC ;
@@ -214,6 +215,7 @@ This file is part of the iText (R) project.
214
215
import com .itextpdf .commons .bouncycastle .cms .ISignerInfoGenerator ;
215
216
import com .itextpdf .commons .bouncycastle .cms .jcajce .IJcaSignerInfoGeneratorBuilder ;
216
217
import com .itextpdf .commons .bouncycastle .cms .jcajce .IJcaSimpleSignerInfoVerifierBuilder ;
218
+ import com .itextpdf .commons .bouncycastle .cms .jcajce .IJceKeyAgreeEnvelopedRecipient ;
217
219
import com .itextpdf .commons .bouncycastle .cms .jcajce .IJceKeyTransEnvelopedRecipient ;
218
220
import com .itextpdf .commons .bouncycastle .openssl .IPEMParser ;
219
221
import com .itextpdf .commons .bouncycastle .openssl .jcajce .IJcaPEMKeyConverter ;
@@ -301,11 +303,14 @@ This file is part of the iText (R) project.
301
303
import org .bouncycastle .cms .CMSSignedData ;
302
304
import org .bouncycastle .cms .CMSTypedData ;
303
305
import org .bouncycastle .cms .jcajce .JcaSimpleSignerInfoVerifierBuilder ;
306
+ import org .bouncycastle .cms .jcajce .JceKeyAgreeEnvelopedRecipient ;
304
307
import org .bouncycastle .cms .jcajce .JceKeyTransEnvelopedRecipient ;
305
308
import org .bouncycastle .jce .provider .BouncyCastleProvider ;
306
309
import org .bouncycastle .openssl .PEMParser ;
307
310
import org .bouncycastle .openssl .jcajce .JcaPEMKeyConverter ;
308
311
import org .bouncycastle .openssl .jcajce .JceOpenSSLPKCS8DecryptorProviderBuilder ;
312
+ import org .bouncycastle .operator .DefaultAlgorithmNameFinder ;
313
+ import org .bouncycastle .operator .DefaultSignatureAlgorithmIdentifierFinder ;
309
314
import org .bouncycastle .operator .jcajce .JcaContentSignerBuilder ;
310
315
import org .bouncycastle .operator .jcajce .JcaContentVerifierProviderBuilder ;
311
316
import org .bouncycastle .operator .jcajce .JcaDigestCalculatorProviderBuilder ;
@@ -332,6 +337,27 @@ public BouncyCastleFactory() {
332
337
// Empty constructor.
333
338
}
334
339
340
+ /**
341
+ * {@inheritDoc}
342
+ */
343
+ @ Override
344
+ public String getAlgorithmOid (String name ) {
345
+ try {
346
+ AlgorithmIdentifier algorithmIdentifier = new DefaultSignatureAlgorithmIdentifierFinder ().find (name );
347
+ return algorithmIdentifier .getAlgorithm ().getId ();
348
+ } catch (IllegalArgumentException ignored ) {
349
+ return null ;
350
+ }
351
+ }
352
+
353
+ /**
354
+ * {@inheritDoc}
355
+ */
356
+ @ Override
357
+ public String getAlgorithmName (String oid ) {
358
+ return new DefaultAlgorithmNameFinder ().getAlgorithmName (new ASN1ObjectIdentifier (oid ));
359
+ }
360
+
335
361
/**
336
362
* {@inheritDoc}
337
363
*/
@@ -844,6 +870,14 @@ public IJceKeyTransEnvelopedRecipient createJceKeyTransEnvelopedRecipient(Privat
844
870
return new JceKeyTransEnvelopedRecipientBC (new JceKeyTransEnvelopedRecipient (privateKey ));
845
871
}
846
872
873
+ /**
874
+ * {@inheritDoc}
875
+ */
876
+ @ Override
877
+ public IJceKeyAgreeEnvelopedRecipient createJceKeyAgreeEnvelopedRecipient (PrivateKey privateKey ) {
878
+ return new JceKeyAgreeEnvelopedRecipientBC (new JceKeyAgreeEnvelopedRecipient (privateKey ));
879
+ }
880
+
847
881
/**
848
882
* {@inheritDoc}
849
883
*/
@@ -1104,7 +1138,7 @@ public IRevokedStatus createRevokedStatus(Date date, int i) {
1104
1138
@ Override
1105
1139
public IDERIA5String createDERIA5String (IASN1TaggedObject taggedObject , boolean b ) {
1106
1140
return new DERIA5StringBC (
1107
- DERIA5String .getInstance (((ASN1TaggedObjectBC ) taggedObject ).getASN1TaggedObject (), b ));
1141
+ ( DERIA5String ) DERIA5String .getInstance (((ASN1TaggedObjectBC ) taggedObject ).getASN1TaggedObject (), b ));
1108
1142
}
1109
1143
1110
1144
/**
0 commit comments