You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "maybevanshh (via GitHub)" <gi...@apache.org> on 2024/05/29 10:58:06 UTC
[PR] NIFI-13231 Added Private key authentication for GitHubFlowRegistryClient [nifi]
maybevanshh opened a new pull request, #8890:
URL: https://github.com/apache/nifi/pull/8890
<!-- Licensed to the Apache Software Foundation (ASF) under one or more -->
<!-- contributor license agreements. See the NOTICE file distributed with -->
<!-- this work for additional information regarding copyright ownership. -->
<!-- The ASF licenses this file to You under the Apache License, Version 2.0 -->
<!-- (the "License"); you may not use this file except in compliance with -->
<!-- the License. You may obtain a copy of the License at -->
<!-- http://www.apache.org/licenses/LICENSE-2.0 -->
<!-- Unless required by applicable law or agreed to in writing, software -->
<!-- distributed under the License is distributed on an "AS IS" BASIS, -->
<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
<!-- See the License for the specific language governing permissions and -->
<!-- limitations under the License. -->
# Summary
[NIFI-13231](https://issues.apache.org/jira/browse/NIFI-13231)
This PR adds function to Generate Jwt Token in GitHubFlowRegistryClient and PrivateKey Authentication support.
# Tracking
Please complete the following tracking steps prior to pull request creation.
### Issue Tracking
- [ ] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
### Pull Request Tracking
- [ ] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
- [ ] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
### Pull Request Formatting
- [ ] Pull Request based on current revision of the `main` branch
- [ ] Pull Request refers to a feature branch with one commit containing changes
# Verification
Please indicate the verification steps performed prior to pull request creation.
### Build
- [ ] Build completed using `mvn clean install -P contrib-check`
- [ ] JDK 21
### UI Contributions
- [ ] NiFi is modernizing its UI. Any contributions that update the [current UI](https://github.com/apache/nifi/tree/main/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui) also need to be implemented in the [new UI](https://github.com/apache/nifi/tree/main/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi).
### Licensing
- [ ] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html)
- [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` files
### Documentation
- [ ] Documentation formatting appears as expected in rendered files
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-13231 Added Private key authentication for GitHubFlowRegistryClient [nifi]
Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on PR #8890:
URL: https://github.com/apache/nifi/pull/8890#issuecomment-2147473349
> Hey @exceptionfactory Thanks a lot for resolving this and teaching me the workaround! Your solution was really helpful and I appreciate the time you took to explain it. I'm looking forward to contributing more to NiFi.
You're welcome, glad to help bring this to completion, and thanks again for the contribution!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-13231 Added Private key authentication for GitHubFlowRegistryClient [nifi]
Posted by "maybevanshh (via GitHub)" <gi...@apache.org>.
maybevanshh commented on PR #8890:
URL: https://github.com/apache/nifi/pull/8890#issuecomment-2147469794
Hey @exceptionfactory Thanks a lot for resolving this and teaching me the workaround! Your solution was really helpful and I appreciate the time you took to explain it. I'm looking forward to contributing more to NiFi.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-13231 Added Private key authentication for GitHubFlowRegistryClient [nifi]
Posted by "maybevanshh (via GitHub)" <gi...@apache.org>.
maybevanshh commented on PR #8890:
URL: https://github.com/apache/nifi/pull/8890#issuecomment-2142028923
Sure
Making these changes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-13231 Added Private key authentication for GitHubFlowRegistryClient [nifi]
Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on code in PR #8890:
URL: https://github.com/apache/nifi/pull/8890#discussion_r1618922463
##########
nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubFlowRegistryClient.java:
##########
@@ -128,7 +128,22 @@ public class GitHubFlowRegistryClient extends AbstractFlowRegistryClient {
.sensitive(true)
.dependsOn(AUTHENTICATION_TYPE, GitHubAuthenticationType.APP_INSTALLATION_TOKEN.name())
.build();
-
+ static final PropertyDescriptor PRIVATE_KEY = new PropertyDescriptor.Builder()
+ .name("Private Key")
+ .description("Private RSA key generated foo Github App to use for Authentication")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .required(true)
+ .sensitive(true)
+ .dependsOn(AUTHENTICATION_TYPE, GitHubAuthenticationType.PRIVATE_KEY.name())
+ .build();
+ static final PropertyDescriptor APP_ID = new PropertyDescriptor.Builder()
+ .name("APP ID")
Review Comment:
```suggestion
.name("App ID")
```
##########
nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubFlowRegistryClient.java:
##########
@@ -128,7 +128,22 @@ public class GitHubFlowRegistryClient extends AbstractFlowRegistryClient {
.sensitive(true)
.dependsOn(AUTHENTICATION_TYPE, GitHubAuthenticationType.APP_INSTALLATION_TOKEN.name())
.build();
-
+ static final PropertyDescriptor PRIVATE_KEY = new PropertyDescriptor.Builder()
+ .name("Private Key")
+ .description("Private RSA key generated foo Github App to use for Authentication")
Review Comment:
Recommend the following wording adjustments, also noting that PKCS 8 is required.
```suggestion
.description("RSA private key associated with GitHub App to use for authentication. The private key must be PEM-encoded using PKCS 8.")
```
##########
nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubFlowRegistryClient.java:
##########
@@ -128,7 +128,22 @@ public class GitHubFlowRegistryClient extends AbstractFlowRegistryClient {
.sensitive(true)
.dependsOn(AUTHENTICATION_TYPE, GitHubAuthenticationType.APP_INSTALLATION_TOKEN.name())
.build();
-
+ static final PropertyDescriptor PRIVATE_KEY = new PropertyDescriptor.Builder()
+ .name("Private Key")
+ .description("Private RSA key generated foo Github App to use for Authentication")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .required(true)
+ .sensitive(true)
+ .dependsOn(AUTHENTICATION_TYPE, GitHubAuthenticationType.PRIVATE_KEY.name())
+ .build();
+ static final PropertyDescriptor APP_ID = new PropertyDescriptor.Builder()
+ .name("APP ID")
+ .description("App Id of Github App to use for Authentication")
Review Comment:
```suggestion
.description("Identifier of GitHub App to use for authentication")
```
##########
nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubRepositoryClient.java:
##########
@@ -35,10 +40,11 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
+import java.io.StringReader;
+import java.security.KeyFactory;
+import java.security.PrivateKey;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.util.*;
Review Comment:
Asterisk imports are not permitted in the the Checkstyle configuration.
##########
nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubRepositoryClient.java:
##########
@@ -379,6 +392,41 @@ public GHContent deleteContent(final String filePath, final String commitMessage
});
}
+ /**
+ * Creates the JwtToken for Authentication with Private Key
+ *
+ * @param pemString is the PKCS#1 String
+ * @return the JwtToken
+ *
+ * @throws Exception if an error occurs parsing key
+ */
+ private static String loadPrivateKeyFromPEM(String pemString) throws Exception {
+ long nowMillis = System.currentTimeMillis();
+ long expMillis = nowMillis + 600000; // Token validity 10 minutes
+ Date now = new Date(nowMillis);
+ Date exp = new Date(expMillis);
+ PEMParser pemParser = new PEMParser(new StringReader(pemString));
+ Object object = pemParser.readObject();
+ pemParser.close();
+
+ if (object instanceof PEMKeyPair) {
+ PEMKeyPair keyPair = (PEMKeyPair) object;
+ RSAPrivateKey rsaPrivateKey = RSAPrivateKey.getInstance(keyPair.getPrivateKeyInfo().parsePrivateKey());
+ PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(rsaPrivateKey.getEncoded());
+ KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+ PrivateKey privateKey = keyFactory.generatePrivate(keySpec);
+ return (Jwts.builder().issuer(builder().appId)
+ .issuedAt(now)
+ .expiration(exp)
+ .signWith(privateKey,SignatureAlgorithm.RS256)
+ .compact());
+ } else {
+ LOGGER.error("Not a valid PKCS#1 PEM string");
+ }
+ LOGGER.warn("INVALID PEM KEY");
+ return "";
Review Comment:
This should throw an exception instead of logging a warning and returning an empty string.
##########
nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubFlowRegistryClient.java:
##########
@@ -128,7 +128,22 @@ public class GitHubFlowRegistryClient extends AbstractFlowRegistryClient {
.sensitive(true)
.dependsOn(AUTHENTICATION_TYPE, GitHubAuthenticationType.APP_INSTALLATION_TOKEN.name())
.build();
-
+ static final PropertyDescriptor PRIVATE_KEY = new PropertyDescriptor.Builder()
+ .name("Private Key")
+ .description("Private RSA key generated foo Github App to use for Authentication")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .required(true)
+ .sensitive(true)
+ .dependsOn(AUTHENTICATION_TYPE, GitHubAuthenticationType.PRIVATE_KEY.name())
+ .build();
+ static final PropertyDescriptor APP_ID = new PropertyDescriptor.Builder()
+ .name("APP ID")
+ .description("App Id of Github App to use for Authentication")
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .required(true)
+ .sensitive(true)
Review Comment:
The App ID is not sensitive, so this can be changed:
```suggestion
.sensitive(false)
```
##########
nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubRepositoryClient.java:
##########
@@ -379,6 +392,41 @@ public GHContent deleteContent(final String filePath, final String commitMessage
});
}
+ /**
+ * Creates the JwtToken for Authentication with Private Key
+ *
+ * @param pemString is the PKCS#1 String
+ * @return the JwtToken
+ *
+ * @throws Exception if an error occurs parsing key
+ */
+ private static String loadPrivateKeyFromPEM(String pemString) throws Exception {
+ long nowMillis = System.currentTimeMillis();
+ long expMillis = nowMillis + 600000; // Token validity 10 minutes
+ Date now = new Date(nowMillis);
+ Date exp = new Date(expMillis);
+ PEMParser pemParser = new PEMParser(new StringReader(pemString));
+ Object object = pemParser.readObject();
+ pemParser.close();
+
+ if (object instanceof PEMKeyPair) {
+ PEMKeyPair keyPair = (PEMKeyPair) object;
+ RSAPrivateKey rsaPrivateKey = RSAPrivateKey.getInstance(keyPair.getPrivateKeyInfo().parsePrivateKey());
+ PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(rsaPrivateKey.getEncoded());
Review Comment:
We should use the utility from the github-api library, even though it is limited to PKCS 8. This avoids the use of the Bouncy Castle library, and also avoids the custom methods for token generation.
##########
nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubAuthenticationType.java:
##########
@@ -24,6 +24,7 @@ public enum GitHubAuthenticationType {
NONE,
PERSONAL_ACCESS_TOKEN,
- APP_INSTALLATION_TOKEN;
+ APP_INSTALLATION_TOKEN,
+ PRIVATE_KEY;
Review Comment:
Although `PRIVATE_KEY` is accurate from one perspective, it would be worth indicating that this uses as a GitHub, so I recommend the following name:
```suggestion
APP_INSTALLATION_ID_AND_PRIVATE_KEY;
```
##########
nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubRepositoryClient.java:
##########
@@ -74,6 +80,13 @@ private GitHubRepositoryClient(final Builder builder) throws IOException, FlowRe
switch (authenticationType) {
case PERSONAL_ACCESS_TOKEN -> gitHubBuilder.withOAuthToken(builder.personalAccessToken);
case APP_INSTALLATION_TOKEN -> gitHubBuilder.withAppInstallationToken(builder.appInstallationToken);
+ case PRIVATE_KEY -> {
+ try {
+ gitHubBuilder.withJwtToken(loadPrivateKeyFromPEM(builder().privateKey));
+ } catch (Exception e) {
+ LOGGER.error("PEM Key or App Id is Invalid");
Review Comment:
The Client is not usable without proper authentication, so an exception should be thrown instead of logging an error. It may be better to pass in the private key instead of reading it in this class.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-13231 Added Private key authentication for GitHubFlowRegistryClient [nifi]
Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on code in PR #8890:
URL: https://github.com/apache/nifi/pull/8890#discussion_r1622354948
##########
nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubRepositoryClient.java:
##########
@@ -19,7 +19,12 @@
package org.apache.nifi.github;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.SignatureAlgorithm;
import org.apache.nifi.registry.flow.FlowRegistryException;
+import org.bouncycastle.asn1.pkcs.RSAPrivateKey;
+import org.bouncycastle.openssl.PEMKeyPair;
+import org.bouncycastle.openssl.PEMParser;
Review Comment:
These imports can be removed.
##########
nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubRepositoryClient.java:
##########
@@ -74,6 +81,15 @@ private GitHubRepositoryClient(final Builder builder) throws IOException, FlowRe
switch (authenticationType) {
case PERSONAL_ACCESS_TOKEN -> gitHubBuilder.withOAuthToken(builder.personalAccessToken);
case APP_INSTALLATION_TOKEN -> gitHubBuilder.withAppInstallationToken(builder.appInstallationToken);
+ case APP_INSTALLATION_ID_AND_PRIVATE_KEY -> {
+ try {
+ JWTTokenProvider jwtTokenProvider = new JWTTokenProvider(builder().appId, builder().privateKey);
+ String token = jwtTokenProvider.getEncodedAuthorization();
+ gitHubBuilder.withJwtToken(token);
+ } catch (Exception e) {
+ throw new FlowRegistryException(e.getMessage());
Review Comment:
A custom message should be set, and the exception passed to the constructor to preserve the stack trace.
```suggestion
throw new FlowRegistryException("Failed to generate JWT from App ID and Private Key", e);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-13231 Added Private key authentication for GitHubFlowRegistryClient [nifi]
Posted by "maybevanshh (via GitHub)" <gi...@apache.org>.
maybevanshh commented on PR #8890:
URL: https://github.com/apache/nifi/pull/8890#issuecomment-2142166337
For some reason JwtTokenProvider throws Bad Credentials , can you please check into it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-13231 Added Private key authentication for GitHubFlowRegistryClient [nifi]
Posted by "maybevanshh (via GitHub)" <gi...@apache.org>.
maybevanshh commented on code in PR #8890:
URL: https://github.com/apache/nifi/pull/8890#discussion_r1622321295
##########
nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubRepositoryClient.java:
##########
@@ -379,6 +392,41 @@ public GHContent deleteContent(final String filePath, final String commitMessage
});
}
+ /**
+ * Creates the JwtToken for Authentication with Private Key
+ *
+ * @param pemString is the PKCS#1 String
+ * @return the JwtToken
+ *
+ * @throws Exception if an error occurs parsing key
+ */
+ private static String loadPrivateKeyFromPEM(String pemString) throws Exception {
+ long nowMillis = System.currentTimeMillis();
+ long expMillis = nowMillis + 600000; // Token validity 10 minutes
+ Date now = new Date(nowMillis);
+ Date exp = new Date(expMillis);
+ PEMParser pemParser = new PEMParser(new StringReader(pemString));
+ Object object = pemParser.readObject();
+ pemParser.close();
+
+ if (object instanceof PEMKeyPair) {
+ PEMKeyPair keyPair = (PEMKeyPair) object;
+ RSAPrivateKey rsaPrivateKey = RSAPrivateKey.getInstance(keyPair.getPrivateKeyInfo().parsePrivateKey());
+ PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(rsaPrivateKey.getEncoded());
Review Comment:
I removed the seperate function for jwt and used JWTTokenProvider for token generation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-13231 Added Private key authentication for GitHubFlowRegistryClient [nifi]
Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on PR #8890:
URL: https://github.com/apache/nifi/pull/8890#issuecomment-2142820021
> For some reason JwtTokenProvider throws Bad Credentials , can you please check into it?
Thanks for the updates. It sounds like an error coming from the GitHub REST API. I will run some local tests as part of adding the key parsing and follow up.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-13231 Added Private key authentication for GitHubFlowRegistryClient [nifi]
Posted by "maybevanshh (via GitHub)" <gi...@apache.org>.
maybevanshh commented on code in PR #8890:
URL: https://github.com/apache/nifi/pull/8890#discussion_r1619921824
##########
nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubRepositoryClient.java:
##########
@@ -379,6 +392,41 @@ public GHContent deleteContent(final String filePath, final String commitMessage
});
}
+ /**
+ * Creates the JwtToken for Authentication with Private Key
+ *
+ * @param pemString is the PKCS#1 String
+ * @return the JwtToken
+ *
+ * @throws Exception if an error occurs parsing key
+ */
+ private static String loadPrivateKeyFromPEM(String pemString) throws Exception {
+ long nowMillis = System.currentTimeMillis();
+ long expMillis = nowMillis + 600000; // Token validity 10 minutes
+ Date now = new Date(nowMillis);
+ Date exp = new Date(expMillis);
+ PEMParser pemParser = new PEMParser(new StringReader(pemString));
+ Object object = pemParser.readObject();
+ pemParser.close();
+
+ if (object instanceof PEMKeyPair) {
+ PEMKeyPair keyPair = (PEMKeyPair) object;
+ RSAPrivateKey rsaPrivateKey = RSAPrivateKey.getInstance(keyPair.getPrivateKeyInfo().parsePrivateKey());
+ PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(rsaPrivateKey.getEncoded());
Review Comment:
I'll commit the changes you requested and will use the utility function for authentication.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-13231 Added Private key authentication for GitHubFlowRegistryClient [nifi]
Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on code in PR #8890:
URL: https://github.com/apache/nifi/pull/8890#discussion_r1619437365
##########
nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubRepositoryClient.java:
##########
@@ -379,6 +392,41 @@ public GHContent deleteContent(final String filePath, final String commitMessage
});
}
+ /**
+ * Creates the JwtToken for Authentication with Private Key
+ *
+ * @param pemString is the PKCS#1 String
+ * @return the JwtToken
+ *
+ * @throws Exception if an error occurs parsing key
+ */
+ private static String loadPrivateKeyFromPEM(String pemString) throws Exception {
+ long nowMillis = System.currentTimeMillis();
+ long expMillis = nowMillis + 600000; // Token validity 10 minutes
+ Date now = new Date(nowMillis);
+ Date exp = new Date(expMillis);
+ PEMParser pemParser = new PEMParser(new StringReader(pemString));
+ Object object = pemParser.readObject();
+ pemParser.close();
+
+ if (object instanceof PEMKeyPair) {
+ PEMKeyPair keyPair = (PEMKeyPair) object;
+ RSAPrivateKey rsaPrivateKey = RSAPrivateKey.getInstance(keyPair.getPrivateKeyInfo().parsePrivateKey());
+ PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(rsaPrivateKey.getEncoded());
Review Comment:
On further research, there are some options for reading PKCS 1 RSA private keys with standard Java `KeyFactory` methods. If you can address some of the other comments, I could add a commit to implement that element of key parsing, which would still enable using the utility method from the github-api library, using `PrivateKey` objects.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-13231 Added Private key authentication for GitHubFlowRegistryClient [nifi]
Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory closed pull request #8890: NIFI-13231 Added Private key authentication for GitHubFlowRegistryClient
URL: https://github.com/apache/nifi/pull/8890
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org