Github user brosander commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1165#discussion_r88056091
  
    --- Diff: 
nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/KeyStoreUtils.java
 ---
    @@ -0,0 +1,62 @@
    +/*
    + * 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.
    + */
    +
    +package org.apache.nifi.security.util;
    +
    +import org.apache.commons.lang3.StringUtils;
    +import org.bouncycastle.jce.provider.BouncyCastleProvider;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.security.KeyStore;
    +import java.security.KeyStoreException;
    +import java.security.Security;
    +
    +public class KeyStoreUtils {
    +    private static final Logger logger = 
LoggerFactory.getLogger(KeyStoreUtils.class);
    +
    +    static {
    +        Security.addProvider(new BouncyCastleProvider());
    +    }
    +
    +    public static String getKeyStoreProvider(String keyStoreType) {
    +        if (KeystoreType.PKCS12.toString().equalsIgnoreCase(keyStoreType)) 
{
    +            return BouncyCastleProvider.PROVIDER_NAME;
    +        }
    +        return null;
    +    }
    +
    +    public static KeyStore getKeyStore(String keyStoreType) throws 
KeyStoreException {
    +        String keyStoreProvider = getKeyStoreProvider(keyStoreType);
    +        if (StringUtils.isNoneEmpty(keyStoreProvider)) {
    --- End diff --
    
    autocomplete fail, will address


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to