|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.cert.cc.util.EncryptionUtils
public final class EncryptionUtils
EncryptionUtils is set of helper methods for dealing with encrypted data.
© 2009 Carnegie Mellon University
Field Summary | |
---|---|
static String |
PROVIDER
The external security provider identifier |
Method Summary | |
---|---|
static void |
addProvider()
Adds the provider to the Security |
static byte[] |
convertBase64Encoded(Message message)
Converts a Base64 encoded email body into binary data. |
static byte[] |
convertBase64Encoded(String text)
Converts a Base64 encoded text into binary data. |
static String |
extractData(String s)
Extracts data from the input String , s . |
static PGPPrivateKey |
findPrivateKey(PGPSecretKeyRingCollection collection,
long keyId,
char[] password)
Returns a PGPPrivateKey from a PGPSecretKeyRingCollection . |
static Set<String> |
getUsers(PGPSecretKey secretKey)
Returns all of the users for a PGPSecretKey |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PROVIDER
Method Detail |
---|
public static byte[] convertBase64Encoded(Message message) throws MessagingException
message
- Email Message
MessagingException
- If unable to convert the Message
public static byte[] convertBase64Encoded(String text) throws MessagingException
BouncyCastle's Base64
class does the actual decoding.
text
- Base64 encoded textual data
MessagingException
- If unable to convert the textpublic static String extractData(String s) throws IOException
String
, s
. The data is extracted
after the first blank line down to a line that starts with "-----END"
s
- Input data
IOException
- If unable to read from the String
, unlikely.public static PGPPrivateKey findPrivateKey(PGPSecretKeyRingCollection collection, long keyId, char[] password) throws PGPException, NoSuchProviderException
PGPPrivateKey
from a PGPSecretKeyRingCollection
. If the PGPPrivateKey
cannot be found, null is returned.
collection
- PGPSecretKeyRingCollection
keyId
- Key Idpassword
- PGPPrivateKey
's password
PGPPrivateKey
PGPException
- If unable to retrieve the PGPPrivateKey
NoSuchProviderException
- If unable to retrieve the PGPPrivateKey
public static Set<String> getUsers(PGPSecretKey secretKey)
PGPSecretKey
secretKey
- PGPSecretKey
Set
of userspublic static void addProvider()
Security
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |