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

    https://github.com/apache/nifi/pull/2376#discussion_r159973528
  
    --- Diff: 
nifi-toolkit/nifi-toolkit-encrypt-config/src/main/groovy/org/apache/nifi/toolkit/encryptconfig/util/BootstrapUtil.groovy
 ---
    @@ -0,0 +1,132 @@
    +/*
    + * 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.toolkit.encryptconfig.util
    +
    +import org.slf4j.Logger
    +import org.slf4j.LoggerFactory
    +
    +class BootstrapUtil {
    +
    +    static final String NIFI_BOOTSTRAP_KEY_PROPERTY = 
"nifi.bootstrap.sensitive.key";
    +    static final String REGISTRY_BOOTSTRAP_KEY_PROPERTY = 
"nifi.registry.bootstrap.sensitive.key";
    +
    +    private static final Logger logger = 
LoggerFactory.getLogger(BootstrapUtil.class)
    +
    +    private static final String BOOTSTRAP_KEY_COMMENT = "# Master key in 
hexadecimal format for encrypted sensitive configuration values"
    +
    +    /**
    +     * Tries to load keyHex from input bootstrap.conf
    +     *
    +     * @return keyHex, if present in input bootstrap file; otherwise, null
    +     */
    +    static String extractKeyFromBootstrapFile(String inputBootstrapPath, 
String bootstrapKeyPropertyName) throws IOException {
    +
    +        File inputBootstrapConfFile
    +        if (!(inputBootstrapPath && (inputBootstrapConfFile = new 
File(inputBootstrapPath)).exists() && inputBootstrapConfFile.canRead())) {
    --- End diff --
    
    Good catch, will change this to use the utility method 
`ToolUtilities.canRead(File)` method used elsewhere


---

Reply via email to