Package org.cryptacular.pem
Class PemObject
java.lang.Object
org.bouncycastle.util.io.pem.PemObject
org.cryptacular.pem.PemObject
- All Implemented Interfaces:
org.bouncycastle.util.io.pem.PemObjectGenerator
public final class PemObject
extends org.bouncycastle.util.io.pem.PemObject
Container for PEM encoded data.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DescriptorDescriptorfor this PEM object which includes the RFC governing its format and other relevant data about the data. -
Constructor Summary
ConstructorsConstructorDescriptionPemObject(Descriptor descriptorParam, byte[] content) Generic constructor for object without headers.PemObject(Descriptor descriptorParam, List<org.bouncycastle.util.io.pem.PemHeader> headers, byte[] content) Generic constructor for object with headers. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidassertHeadersValid(List<org.bouncycastle.util.io.pem.PemHeader> headers) Throws an exception if the headers are not according to their governing RFC format.private voidassertPemHeaderValid(List<org.bouncycastle.util.io.pem.PemHeader> headers, Set<String> specifiers, Format format, boolean allowX, boolean disregardX) Checks to make sure a given list ofPemHeaderinstances the names specified are valid.static PemObjectdecode(byte[] encoded) Decodes the supplied bytes into aPemObject.Returns descriptor on PEM objectMethods inherited from class org.bouncycastle.util.io.pem.PemObject
generate, getContent, getHeaders, getType
-
Field Details
-
descriptor
Descriptorfor this PEM object which includes the RFC governing its format and other relevant data about the data.
-
-
Constructor Details
-
PemObject
Generic constructor for object without headers.- Parameters:
descriptorParam- Descriptor on the content (i.e. RFC governing PEM format, type etc.)content- The binary content of the object.
-
PemObject
public PemObject(Descriptor descriptorParam, List<org.bouncycastle.util.io.pem.PemHeader> headers, byte[] content) Generic constructor for object with headers.- Parameters:
descriptorParam- Descriptor on the content (i.e. RFC governing PEM format, type etc.)headers- A list of PemHeader objects.content- The binary content of the object.
-
-
Method Details
-
decode
Decodes the supplied bytes into aPemObject.- Parameters:
encoded- to decode- Returns:
- PEM object
- Throws:
EncodingException- if the bytes cannot be decoded
-
getDescriptor
Returns descriptor on PEM object- Returns:
Descriptor
-
assertHeadersValid
Throws an exception if the headers are not according to their governing RFC format.- Parameters:
headers- headers
-
assertPemHeaderValid
private void assertPemHeaderValid(List<org.bouncycastle.util.io.pem.PemHeader> headers, Set<String> specifiers, Format format, boolean allowX, boolean disregardX) throws IllegalArgumentException Checks to make sure a given list ofPemHeaderinstances the names specified are valid.- Parameters:
headers- headersspecifiers- Set of allowed specifiers/headersformat- RFC formatallowX- Allow specifiers/headers starting with X-disregardX- Treat specifiers/headers starting with X- as if they do not- Throws:
IllegalArgumentException- If header element in the headers list is not valid
-