Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
change the blob into a base64-encoded string
Browse files Browse the repository at this point in the history
  • Loading branch information
qmx committed Jan 22, 2015
1 parent 53f041e commit 0921280
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
12 changes: 12 additions & 0 deletions model/api/pom.xml
Expand Up @@ -37,6 +37,18 @@
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.aerogear</groupId>
<artifactId>aerogear-crypto</artifactId>
</dependency>

<dependency>
<groupId>bouncycastle</groupId>
<artifactId>bcprov-jdk16</artifactId>
<version>140</version>
</dependency>

</dependencies>

<profiles>
Expand Down
Expand Up @@ -21,11 +21,13 @@

import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;
import org.jboss.aerogear.crypto.encoders.Base64;

/**
* The iOS variant class encapsulates APNs specific behavior.
*/
public class iOSVariant extends Variant {
private static final Base64 encoder = new Base64();
private static final long serialVersionUID = -889367404039436329L;

private boolean production;
Expand All @@ -37,7 +39,7 @@ public class iOSVariant extends Variant {

@NotNull(message = "Certificate must be provided")
@JsonIgnore
private byte[] certificate;
private String certificateData;

/**
* If <code>true</code> a connection to Apple's Production APNs server
Expand Down Expand Up @@ -75,12 +77,12 @@ public void setPassphrase(final String passphrase) {
*/
@JsonIgnore
public byte[] getCertificate() {
return certificate;
return encoder.decode(certificateData);
}

@JsonProperty
public void setCertificate(byte[] cert) {
this.certificate = cert;
this.certificateData = encoder.encode(cert);
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions model/jpa/src/main/resources/META-INF/orm.xml
Expand Up @@ -63,8 +63,8 @@ http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
<entity class="iOSVariant" access="FIELD">
<discriminator-value>ios</discriminator-value>
<attributes>
<basic name="certificate">
<lob/>
<basic name="certificateData">
<column length="100000"/>
</basic>
</attributes>
</entity>
Expand Down

0 comments on commit 0921280

Please sign in to comment.