@@ -38,18 +38,16 @@ class CsrHelper {
38
38
*
39
39
* @param keyPair the KeyPair with private and public keys
40
40
* @param userId userId of CSR owner
41
- * @param algorithm represents supported signature algorithm
42
41
* @return PEM encoded CSR string
43
42
* @throws IOException thrown if key cannot be created
44
43
* @throws OperatorCreationException thrown if contentSigner cannot be build
45
44
*/
46
45
@Throws(IOException ::class , OperatorCreationException ::class )
47
46
fun generateCsrPemEncodedString (
48
47
keyPair : KeyPair ,
49
- userId : String ,
50
- algorithm : SignatureAlgorithm
48
+ userId : String
51
49
): String {
52
- val csr = generateCSR(keyPair, userId, algorithm )
50
+ val csr = generateCSR(keyPair, userId)
53
51
val derCSR = csr.encoded
54
52
return " -----BEGIN CERTIFICATE REQUEST-----\n " +
55
53
Base64 .encodeToString(
@@ -63,7 +61,6 @@ class CsrHelper {
63
61
*
64
62
* @param keyPair the KeyPair with private and public keys
65
63
* @param userId userId of CSR owner
66
- * @param algorithm represents supported signature algorithm
67
64
* @return PKCS10CertificationRequest with the certificate signing request (CSR) data
68
65
* @throws IOException thrown if key cannot be created
69
66
* @throws OperatorCreationException thrown if contentSigner cannot be build
@@ -73,12 +70,12 @@ class CsrHelper {
73
70
private fun generateCSR (
74
71
keyPair : KeyPair ,
75
72
userId : String ,
76
- algorithm : SignatureAlgorithm
77
73
): PKCS10CertificationRequest {
78
74
val principal = " CN=$userId "
75
+
79
76
val privateKey = PrivateKeyFactory .createKey(keyPair.private.encoded)
80
- val signatureAlgorithm = DefaultSignatureAlgorithmIdentifierFinder ().find(algorithm .signatureAlg)
81
- val digestAlgorithm = DefaultDigestAlgorithmIdentifierFinder ().find(algorithm .digestAlg)
77
+ val signatureAlgorithm = DefaultSignatureAlgorithmIdentifierFinder ().find(SignatureAlgorithm . SHA256 .signatureAlg)
78
+ val digestAlgorithm = DefaultDigestAlgorithmIdentifierFinder ().find(SignatureAlgorithm . SHA256 .digestAlg)
82
79
val signer =
83
80
BcRSAContentSignerBuilder (signatureAlgorithm, digestAlgorithm).build(privateKey)
84
81
val csrBuilder: PKCS10CertificationRequestBuilder =
0 commit comments