kwin commented on code in PR #654: URL: https://github.com/apache/maven-site/pull/654#discussion_r1932014698
########## content/markdown/guides/mini/guide-encryption-4.md: ########## @@ -0,0 +1,74 @@ +# Password Encryption (Maven 4) + +<!-- +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. +--> +<!--MACRO{toc|fromDepth=2}--> + +## Introduction + +Maven 4 introduces an enhanced encryption providing more secure handling of password than provided by [the one from Maven 2/3](guide-encryption.html). +However it still sticks to the principle of keeping the *symmetrically encrypted values* directly within the `settings.xml`. + +A single master key is used for both decrypting and encrypting and therefore should be always kept at a safe place. *Everyone with that key can decrypt all encrypted values from your `settings.xml`.* + +## Master Key Sources + +There are different master key source implementations shipping with Maven with which the master key may be retrieved: + +1. Plain file (`file:<filepath>`), the filepath must be absolute. Only considered secure if located on a protected file system. +2. Environment variable (`env:<variable-name>`), the environment variable must be externally populated via some secure means. +3. Java System Properties (`system-property:<property-name>`), the Java system property must be externally populated via some secure means. +3. GnuPG Agent (`gpg-agent:<agentSocketPath>(?non-interactive)`), requires one manual input per user session. +4. PinEntry (`pinentry-prompt:path`), requires manual input of the password every time a decryption is required. + +One has to pick an implementation depending on the security and ease-of-use requirements. + +## Setup + +There is a dedicated tool named `mvnenc` shipping with Maven 4 which helps both with the setup and encryption of values, as well as diagnosis in case of issues. +Start by executing `mvnenc init` and then select + +1. The source +2. The cipher (currently there is only the default one provided) +3. The source-specific value + +Afterwards check with `mvnenc diag` if the configuration is valid. + +## Create encrypted values + +Execut `mvnenc encrypt` and afterwards enter the value to encrypt via the CLI. The tool emits the encrypted value in the format + +``` +{[name=master,cipher=AES/GCM/NoPadding,version=4.0]abcdefg} +``` + Review Comment: What about programmatic access? Which API should be leveraged? -- 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-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org