Skip to content

Instantly share code, notes, and snippets.

🥑
Living the dream

Todd Sharp recursivecodes

🥑
Living the dream
Block or report user

Report or block recursivecodes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View test.js
logout: function() {
  localStorage.removeItem("user");
  this.currentUser = null;
  this.setView(this.LOGIN);
}
View pom.xml
<dependency>
    <groupId>com.oracle.oci.sdk</groupId>
    <artifactId>oci-java-sdk-keymanagement</artifactId>
    <version>1.6.0</version>
</dependency>
View pom.xml
<dependency>
    <groupId>javax.activation</groupId>
    <artifactId>javax.activation-api</artifactId>
    <version>1.2.0</version>
</dependency>
View Dockerfile
FROM fnproject/fn-java-fdk-build:jdk11-1.0.98 as build-stage
WORKDIR /function
ENV MAVEN_OPTS -Dhttp.proxyHost= -Dhttp.proxyPort= -Dhttps.proxyHost= -Dhttps.proxyPort= -Dhttp.nonProxyHosts= -Dmaven.repo.local=/usr/share/maven/ref/repository
ADD pom.xml /function/pom.xml
RUN ["mvn", "package", "dependency:copy-dependencies", "-DincludeScope=runtime", "-DskipTests=true", "-Dmdep.prependGroupId=true", "-DoutputDirectory=target", "--fail-never"]
ADD src /function/src
RUN ["mvn", "package", "-DskipTests=true"]
View generate-dek.sh
oci kms crypto generate-data-encryption-key \
--key-id ocid1.key.oc1.phx.... \
--include-plaintext-key true \
--key-shape "{\"algorithm\": \"AES\", \"length\": 16}" \
--endpoint [Cryptographic Endpoint]
View Encrypt.java
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.SecureRandom;
import java.util.Base64;
class Main {
View KmsDemoFunction.java
package codes.recursive;
import com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider;
import com.oracle.bmc.auth.ConfigFileAuthenticationDetailsProvider;
import com.oracle.bmc.auth.ResourcePrincipalAuthenticationDetailsProvider;
import com.oracle.bmc.keymanagement.KmsCryptoClient;
import com.oracle.bmc.keymanagement.model.DecryptDataDetails;
import com.oracle.bmc.keymanagement.requests.DecryptRequest;
import com.oracle.bmc.keymanagement.responses.DecryptResponse;
View env.sh
#!/usr/bin/env bash
export ENCRYPTED_PASSWORD=
export INIT_VECTOR_STRING=
export KEY_OCID=
export DEK_CIPHERTEXT=
export ENDPOINT=
export USE_RESOURCE_PRINCIPAL=false
View KmsDemoFunctionTest.java
package codes.recursive;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fnproject.fn.testing.*;
import org.junit.*;
import java.io.IOException;
import java.util.Map;
import static org.junit.Assert.*;
View HelloFunction.java
package com.example.fn;
import com.drew.imaging.ImageMetadataReader;
import com.drew.imaging.ImageProcessingException;
import com.drew.metadata.Metadata;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.cloudevents.CloudEvent;
import java.io.IOException;
import java.io.InputStream;
You can’t perform that action at this time.