forked from google/keyczar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request google#189 from divegeek/master
Enable custom implementations of KeyczarReader
- Loading branch information
Showing
4 changed files
with
39 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,29 +39,29 @@ | |
* @author [email protected] (Arkajit Dey) | ||
* | ||
*/ | ||
class GenericKeyczar extends Keyczar { | ||
GenericKeyczar(KeyczarReader reader) throws KeyczarException { | ||
public class GenericKeyczar extends Keyczar { | ||
public GenericKeyczar(KeyczarReader reader) throws KeyczarException { | ||
super(reader); | ||
} | ||
|
||
GenericKeyczar(String location) throws KeyczarException { | ||
public GenericKeyczar(String location) throws KeyczarException { | ||
super(location); | ||
} | ||
|
||
@Override | ||
boolean isAcceptablePurpose(KeyPurpose purpose) { | ||
public boolean isAcceptablePurpose(KeyPurpose purpose) { | ||
return true; | ||
} | ||
|
||
KeyMetadata getMetadata() { | ||
public KeyMetadata getMetadata() { | ||
return this.kmd; | ||
} | ||
|
||
Set<KeyVersion> getVersions() { | ||
public Set<KeyVersion> getVersions() { | ||
return Collections.unmodifiableSet(versionMap.keySet()); | ||
} | ||
|
||
KeyczarKey getKey(KeyVersion v) { | ||
public KeyczarKey getKey(KeyVersion v) { | ||
return versionMap.get(v); | ||
} | ||
|
||
|
@@ -73,7 +73,7 @@ KeyczarKey getKey(KeyVersion v) { | |
* @throws KeyczarException if invalid version number or trying to promote | ||
* a primary key. | ||
*/ | ||
void promote(int versionNumber) throws KeyczarException { | ||
public void promote(int versionNumber) throws KeyczarException { | ||
KeyVersion version = getVersion(versionNumber); | ||
switch (version.getStatus()) { | ||
case PRIMARY: | ||
|
@@ -100,7 +100,7 @@ void promote(int versionNumber) throws KeyczarException { | |
* @throws KeyczarException if invalid version number or trying to demote | ||
* a key scheduled for revocation. | ||
*/ | ||
void demote(int versionNumber) throws KeyczarException { | ||
public void demote(int versionNumber) throws KeyczarException { | ||
KeyVersion version = getVersion(versionNumber); | ||
switch (version.getStatus()) { | ||
case PRIMARY: | ||
|
@@ -119,7 +119,7 @@ void demote(int versionNumber) throws KeyczarException { | |
/** | ||
* Uses default key parameters to add a new key version. | ||
*/ | ||
void addVersion(KeyStatus status) throws KeyczarException { | ||
public void addVersion(KeyStatus status) throws KeyczarException { | ||
addVersion(status, kmd.getType().applyDefaultParameters(null)); | ||
} | ||
|
||
|
@@ -132,7 +132,7 @@ void addVersion(KeyStatus status) throws KeyczarException { | |
* @param keyParams parameters for new key generation. | ||
* @throws KeyczarException if key type is unsupported. | ||
*/ | ||
void addVersion(KeyStatus status, KeyParameters keyParams) throws KeyczarException { | ||
public void addVersion(KeyStatus status, KeyParameters keyParams) throws KeyczarException { | ||
KeyType type = kmd.getType(); | ||
KeyczarKey key; | ||
do { | ||
|
@@ -176,7 +176,7 @@ private int maxVersion() { | |
* @return KeyVersion if it exists | ||
* @throws KeyczarException if version number doesn't exist | ||
*/ | ||
KeyVersion getVersion(int versionNumber) throws KeyczarException { | ||
public KeyVersion getVersion(int versionNumber) throws KeyczarException { | ||
KeyVersion version = kmd.getVersion(versionNumber); | ||
if (version == null) { | ||
throw new KeyczarException( | ||
|
@@ -193,7 +193,7 @@ KeyVersion getVersion(int versionNumber) throws KeyczarException { | |
* @throws KeyczarException if version number nonexistent or key is not | ||
* scheduled for revocation. | ||
*/ | ||
void revoke(int versionNumber) throws KeyczarException { | ||
public void revoke(int versionNumber) throws KeyczarException { | ||
KeyVersion version = getVersion(versionNumber); | ||
if (version.getStatus() == KeyStatus.INACTIVE) { | ||
kmd.removeVersion(versionNumber); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters