For symmetic encryption, you can use the following:
To encrypt:
openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt
To decrypt:
package main | |
import ( | |
"fmt" | |
"github.com/aws/aws-sdk-go/aws" | |
"github.com/aws/aws-sdk-go/aws/session" | |
"github.com/aws/aws-sdk-go/service/ssm" | |
) |
package main | |
import ( | |
"bytes" | |
"fmt" | |
"io" | |
"os" | |
"strings" | |
) |
private static final key = "mailgun_key" | |
public static boolean isSignatureValid(String token , long timestamp, String signature) { | |
try { | |
Mac hmac = Mac.getInstance("HmacSHA256"); | |
SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(), "HmacSHA256"); | |
hmac.init(signingKey); | |
String signed = Hex.encodeHexString(hmac.doFinal((timestamp + token).getBytes())); | |
if (signed.equals(signature)) { | |
return true; | |
} |
package main | |
import ( | |
"context" | |
"crypto/tls" | |
"fmt" | |
"log" | |
"net/http" | |
"net/url" | |
"time" |
# This is an example Makefile for quick package creation | |
# | |
# It uses FPM [1] to generate simple packages. | |
# - If you need more features or a greater quality package, use debian | |
# standard tools for packaging. | |
# - Do not use checkinstall. Use FPM instead. | |
# | |
# [1] (https://github.com/jordansissel/fpm/wiki) | |
# IMPORTANT: |
// Report sem screenShot | |
var jasmineSpecReporterSetup = function() { | |
var SpecReporter = require('jasmine-spec-reporter'); | |
jasmine.getEnv().addReporter(new SpecReporter({ | |
displayFailuresSummary: true, //mostra resumo das falhas | |
displaysFailedSpec: true, //exibe os testes que falharam | |
displaySuiteNumber: true, //numero do teste na suite | |
displaySpecDuration: true //tempo de execução dos testes |
// Report sem screenShot | |
var jasmineSpecReporterSetup = function() { | |
var SpecReporter = require('jasmine-spec-reporter'); | |
jasmine.getEnv().addReporter(new SpecReporter({ | |
displayFailuresSummary: true, //mostra resumo das falhas | |
displaysFailedSpec: true, //exibe os testes que falharam | |
displaySuiteNumber: true, //numero do teste na suite | |
displaySpecDuration: true //tempo de execução dos testes |
public class SomeInterceptor extends HandlerInterceptorAdapter{ | |
@Override | |
public boolean preHandle(final HttpServletRequest request,final HttpServletResponse response,final Object handler) | |
throws Exception | |
{ | |
/*Assume the URI is user/{userId}/post/{postId} and our interceptor is registered for this URI. | |
* This map would then be a map of two elements,with keys 'userId' and 'postId' | |
*/ | |
final Map<String, String> pathVariables = (Map<String, String>) request | |
.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE); |
{ | |
"APIGatewayServiceRolePolicy": { | |
"Arn": "arn:aws:iam::aws:policy/aws-service-role/APIGatewayServiceRolePolicy", | |
"AttachmentCount": 0, | |
"CreateDate": "2019-10-22T18:22:01+00:00", | |
"DefaultVersionId": "v6", | |
"Document": { | |
"Statement": [ | |
{ | |
"Action": [ |