Skip to content

Commit

Permalink
merge v2.2.0 (#42)
Browse files Browse the repository at this point in the history
* beginning of v2.2.0 development

Signed-off-by: Edi Permadi <[email protected]>

* cosmetic

Signed-off-by: Edi Permadi <[email protected]>

* change BlobPool::getBlobTags return type

Signed-off-by: Edi Permadi <[email protected]>

* implemented list blob by tag. close #21

Signed-off-by: Edi Permadi <[email protected]>

* added feature to create recipient. close #28

Signed-off-by: Edi Permadi <[email protected]>

* added feature to list recipient. close #27

Signed-off-by: Edi Permadi <[email protected]>

* added feature to get recipient certificate and metatada. close #29

Signed-off-by: Edi Permadi <[email protected]>

* added feature to update recipient certificate and metadata. close #31

Signed-off-by: Edi Permadi <[email protected]>

* check existing recipient name. close #37

Signed-off-by: Edi Permadi <[email protected]>

* added feature to delete recipient. close #30

Signed-off-by: Edi Permadi <[email protected]>

* bump to v2.2.0

Signed-off-by: Edi Permadi <[email protected]>
  • Loading branch information
edipermadi authored Oct 22, 2017
1 parent 047f6db commit 81071c9
Show file tree
Hide file tree
Showing 10 changed files with 533 additions and 22 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Blobfish Changelog

## v2.2.0 [October 22, 2017]

**Enhancement**

- BlobPool::getBlobTags now returns map of `tag-uuid` and `tag-value`

**New Features**

- List blob by tag
- Create recipient
- List recipient
- Get recipient certificate
- Get recipient metadata
- Update recipient certificate
- Update recipient metadata
- Delete recipient by `recipient-uuid`

## v2.1.0 [October 19, 2017]

**Bugfix**
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
## Overview
An ugly blob container based on protobuf. The project is meant to be an educational PGP-Like tamper-proof file container.

![Blobby Twerkin](src/test/resources/twerkin.gif)

Image courtesy of [Blobby the Blobfish](http://thelastblobfish.tumblr.com/)

## Features
- [x] Container Features
- [x] Versioned container
Expand Down Expand Up @@ -32,6 +36,7 @@ An ugly blob container based on protobuf. The project is meant to be an educatio
- [ ] Export to blobfish container
- [ ] Recipient CRUD access
- [ ] Blob CRUD access
- [x] Tag CRUD access

## Blobfish Random Facts
- [The Ugliest Animal](https://www.theguardian.com/environment/2013/sep/12/blobfish-world-ugliest-animal)
Expand Down
3 changes: 1 addition & 2 deletions doc/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ H2 Database will be used to store recipient certificates, tags and blobs
| id | INTEGER, PRIMARY KEY, AUTO INCREMENT | Recipient internal identifier |
| uuid | VARCHAR(36), NOT NULL, UNIQUE | Recipient external identifier (uuid) |
| name | VARCHAR(64), NOT NULL, UNIQUE | Recipient Name |
| meta | CLOB, NULL | Recipient Metadata |
| metadata | CLOB, NULL | Recipient Metadata |
| certificate | BLOB, NOT NULL | DER encoded Recipient Certificate |
| imported | BOOL, NOT NULL | True when certificate was imported from a blobfish container |
| created_at | TIMESTAMP, NOT NULL | Entry insertion timestamp |

`recipients` table will be indexed by
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.github.edipermadi.security</groupId>
<artifactId>blobfish</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import java.io.IOException;
import java.io.InputStream;
import java.security.PrivateKey;
import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.sql.SQLException;
import java.util.Map;
import java.util.Set;
import java.util.UUID;

/**
Expand Down Expand Up @@ -67,14 +67,25 @@ public interface BlobPool {
*/
Map<UUID, Blob.SimplifiedMetadata> listAvailableBlobs(int page, int size) throws SQLException;

/**
* List blobs which has given tag
*
* @param tagId tag identifier
* @param page number starts from 1
* @param size page size at least 1
* @return map of blob uuid and corresponding metadata
* @throws SQLException when reading blob failed
*/
Map<UUID, Blob.SimplifiedMetadata> listBlobsWithTag(UUID tagId, int page, int size) throws SQLException;

/**
* Get tags of a particular blob
*
* @param blobId blob identifier
* @return set of tags
* @return map of tag-uuid and its value
* @throws SQLException when reading tags failed
*/
Set<String> getBlobTags(UUID blobId) throws SQLException;
Map<UUID, String> getBlobTags(UUID blobId) throws SQLException;

/**
* Create a new tag
Expand Down Expand Up @@ -106,6 +117,7 @@ public interface BlobPool {

/**
* Remove a tag
*
* @param tagId tag identifier
* @return true when tag deleted successfully
* @throws SQLException when updating tag failed
Expand Down Expand Up @@ -141,4 +153,75 @@ public interface BlobPool {
* @throws IOException when reading blob payload failed
*/
byte[] getBlobPayload(UUID blobId) throws SQLException, IOException;

/**
* Add recipient
*
* @param name name of recipient
* @param metadata optional metadata for user
* @param certificate encryption certificate, must be RSA
* @return UUID of recipient
* @throws SQLException when recipient creation failed
* @throws CertificateEncodingException when encoding certificate failed
*/
UUID createRecipient(String name, String metadata, X509Certificate certificate) throws SQLException, CertificateEncodingException;

/**
* List recipient
*
* @param page page number, starts from 1
* @param size page size, at least 1
* @return map of recipient-uuid to recipient-name
* @throws SQLException when listing recipient failed
*/
Map<UUID, String> listRecipient(int page, int size) throws SQLException;

/**
* Get recipient certificate
*
* @param recipientId recipient identifier
* @return RSA X.509 certificate of recipient
* @throws SQLException when retrieving recipient failed
* @throws CertificateException when parsing certificate failed
*/
X509Certificate getRecipientCertificate(UUID recipientId) throws SQLException, CertificateException;

/**
* Get recipient metadata
*
* @param recipientId recipient identifier
* @return recipient string or null if not set
* @throws SQLException when retrieving recipient failed
*/
String getRecipientMetadata(UUID recipientId) throws SQLException;

/**
* Update recipient certificate
*
* @param recipientId recipient identifier
* @param certificate new recipient certificate
* @return true when updated successfully
* @throws SQLException when updating failed
* @throws CertificateException when encoding certificate failed
*/
boolean updateRecipientCertificate(UUID recipientId, X509Certificate certificate) throws SQLException, CertificateException;

/**
* Update recipient metadata
*
* @param recipientId recipient identifier
* @param metadata new recipient metadata
* @return true when updated successfully
* @throws SQLException when updating failed
*/
boolean updateRecipientMetadata(UUID recipientId, String metadata) throws SQLException;

/**
* Delete recipient
*
* @param recipientId recipient identifier
* @return true when deleted successfully
* @throws SQLException when deletion failed
*/
boolean deleteRecipient(UUID recipientId) throws SQLException;
}
Loading

0 comments on commit 81071c9

Please sign in to comment.