This works for me:

*curl -H 'Authorization: bearer XXXXX' -H 'Accept: application/vnd.go.cd
<http://vnd.go.cd>+json' https://build.gocd.org/go/api/admin/encrypt
<https://build.gocd.org/go/api/admin/encrypt> -d '{"value": "badger"}' -H
'Content-Type: application/json'*
{
  "_links" : {
    "doc" : {
      "href" : "https://api.gocd.org/23.1.0/#encryption";
    },
    "self" : {
      "href" : "https://build.gocd.org/go/api/admin/encrypt";
    }
  },
  "encrypted_value" : "AES:YYY:ZZZ"
}

- Ketan



On Wed, Nov 23, 2022 at 2:22 AM Tsanko Stoev <[email protected]> wrote:

> I am using https://host/go/api/admin/encrypt
> I have tried it in SoapUI and also tried the example with curl. Same
> results. Give it a try.
>
> Tsanko
>
> On Tue, Nov 22, 2022, 13:02 Aravind SV <[email protected]> wrote:
>
>> What is the URL you're using / what's the full call? I've used it before,
>> yes.
>>
>> On Tue, Nov 22, 2022 at 3:47 PM Tsanko Stoev <[email protected]> wrote:
>>
>>> That's the first thing I tried but it seems that the API call is not
>>> working or I am doing something wrong as I am getting the following
>>> response:
>>> -- START --
>>>
>>> HTTP/1.1 404 Not Found
>>> Content-Type: text/plain;charset=utf-8
>>> Expires: Thu, 01 Jan 1970 00:00:00 GMT
>>> Set-Cookie: JSESSIONID=node01g8wiol63q14ljfilz086yxyo570.node0;
>>> Path=/go; Expires=Tue, 06-Dec-2022 15:43:28 GMT; Max-Age=1209600; Secure;
>>> HttpOnly
>>> X-XSS-Protection: 1; mode=block
>>> X-Content-Type-Options: nosniff
>>> X-Frame-Options: SAMEORIGIN
>>> X-UA-Compatible: chrome=1
>>> X-Powered-By: ARR/3.0
>>> X-Powered-By: ASP.NET
>>> Date: Tue, 22 Nov 2022 15:43:27 GMT
>>> Content-Length: 58
>>> Strict-Transport-Security: max-age=31536000; includeSubDomains
>>>
>>> The url you are trying to reach appears to be incorrect.
>>>
>>> -- END ---
>>>
>>> Have you successfully been able to use it?
>>> Thanks.
>>>
>>> Tsanko
>>>
>>>
>>> On Tue, Nov 22, 2022 at 4:00 AM Aravind SV <[email protected]>
>>> wrote:
>>>
>>>> Oh. Yes, Chad is right. That's a better way. :)
>>>>
>>>> On Tue, Nov 22, 2022 at 9:58 AM Chad Wilson <[email protected]>
>>>> wrote:
>>>>
>>>>> If seeking higher degrees of automation, I believe you can also use
>>>>> the API at https://api.gocd.org/current/#encrypt-a-plain-text-value
>>>>> for this, alongside a personal access token or another credential - but I
>>>>> haven't personally tried it for this purpose.
>>>>>
>>>>> I am sure Aravind can correct me if this is for a different purpose
>>>>> and encrypts differently. :-)
>>>>>
>>>>>
>>>>> On Tue, Nov 22, 2022 at 5:50 PM Aravind SV <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> I would say the easiest way would be to add a secure environment
>>>>>> variable to any job or pipeline and copy the encrypted value off of the
>>>>>> config XML. I vaguely remember a command-line utility for it, but copying
>>>>>> it off the config XML is likely simpler at this time.
>>>>>>
>>>>>> Cheers,
>>>>>> Aravind
>>>>>>
>>>>>> On Mon, Nov 21, 2022 at 9:21 PM Tsanko Stoev <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> Hello All,
>>>>>>>
>>>>>>> I was browsing the GoCD documentation and specifically database
>>>>>>> connection properties. There is a way to use an encrypted password for 
>>>>>>> the
>>>>>>> connection (db.encryptedPassword). How does one go about creating
>>>>>>> an encrypted value from the plain text password?
>>>>>>> Thank you in advance.
>>>>>>>
>>>>>>> Sincerely,
>>>>>>> Tsanko Stoev
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "go-cd" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to [email protected].
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/go-cd/CAGWsXCB3gagSK2jcfxkhQB9rJhxT41-UfkXZDZ8HXcvUb6X9tQ%40mail.gmail.com
>>>>>>> <https://groups.google.com/d/msgid/go-cd/CAGWsXCB3gagSK2jcfxkhQB9rJhxT41-UfkXZDZ8HXcvUb6X9tQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "go-cd" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/go-cd/CACxychF1N%2Ba9aR1GaLobs%3Dh0ZHgpuLKWfE%3DarHg_x6T4gi5xGw%40mail.gmail.com
>>>>>> <https://groups.google.com/d/msgid/go-cd/CACxychF1N%2Ba9aR1GaLobs%3Dh0ZHgpuLKWfE%3DarHg_x6T4gi5xGw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "go-cd" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/go-cd/CAA1RwH-7ZNrFbwS8zMEY%3DiOwcVceJ2L49K-dHNzYDBP_bjewsQ%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/go-cd/CAA1RwH-7ZNrFbwS8zMEY%3DiOwcVceJ2L49K-dHNzYDBP_bjewsQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "go-cd" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/go-cd/CACxychEGBMCkOJ89Fbykoe%2BPx3uhXaJvZ1ij%3Dz%3DeKr%2Bw-tugmg%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/go-cd/CACxychEGBMCkOJ89Fbykoe%2BPx3uhXaJvZ1ij%3Dz%3DeKr%2Bw-tugmg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "go-cd" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/go-cd/CAGWsXCDgovMsLqHEcbzNOdF880oUJjDkdhvxy2jUZKwQMiksgg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/go-cd/CAGWsXCDgovMsLqHEcbzNOdF880oUJjDkdhvxy2jUZKwQMiksgg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "go-cd" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/go-cd/CACxychF65ACZEEiT3jmu1bz-NxMWT%3DnKpxd%3D_cpr0v36g3ZjAA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/go-cd/CACxychF65ACZEEiT3jmu1bz-NxMWT%3DnKpxd%3D_cpr0v36g3ZjAA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "go-cd" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/go-cd/CAGWsXCBos7zs7SuLqTiFzDpu8E53Q0pf9XwOcFqNnnOL62y6LA%40mail.gmail.com
> <https://groups.google.com/d/msgid/go-cd/CAGWsXCBos7zs7SuLqTiFzDpu8E53Q0pf9XwOcFqNnnOL62y6LA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/go-cd/CAMUPJd5yuXCSMrYHHaRYcWxpd8m%3DVXpSf3bgCVQjBY-qrR78bw%40mail.gmail.com.

Reply via email to