java.lang.Object
net.i2p.crypto.DirKeyRing
- All Implemented Interfaces:
KeyRing
Field Summary
Constructor Summary
ConstructorsConstructorDescriptionDirKeyRing(File baseDir) Constructor for a read-only keyring on the local filesystem.Method Summary
Modifier and TypeMethodDescriptionLoad a public key from the certificate in the given scope.private static SigAlgojcaAlgorithm(String alg) Map a JCA public key algorithm name to a SigAlgo, or null if the name is not recognized (check is then skipped).voidStore a public key.
Field Details
_base
Directory the key files are read from and written to.
Constructor Details
DirKeyRing
Constructor for a read-only keyring on the local filesystem.- Parameters:
baseDir- the directory holding one subdirectory per scope
Method Details
getKey
public PublicKey getKey(String keyName, String scope, SigType type) throws GeneralSecurityException, IOException Load a public key from the certificate in the given scope. Cert must be in the file (escaped keyName).crt, and have a CN == keyName.This DOES do a revocation check.
CN check unsupported on Android.
- Specified by:
getKeyin interfaceKeyRing- Parameters:
keyName- the key name, also the expected certificate CNscope- the directory under the keyring basetype- the expected signature type, checked against the cert's actual key type; null skips the check- Returns:
- null if file doesn't exist, throws on all other errors
- Throws:
GeneralSecurityException- if the stored key cannot be decodedIOException- if the backing store cannot be read
jcaAlgorithm
setKey