CARVIEW |
Select Language
HTTP/1.1 200 OK
Date: Wed, 23 Jul 2025 13:20:53 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Last-Modified: Fri, 16 May 2025 20:50:18 GMT
Vary: Accept-Encoding
ETag: W/"6827a50a-6dae"
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Access-Control-Allow-Origin: *
Content-Encoding: gzip
PEMRecord (Java SE 25 & JDK 25 [ad-hoc build])
This specification is not final and is subject to change. Use is subject to license terms.
Record Class PEMRecord
java.lang.Object
java.lang.Record
java.security.PEMRecord
- Record Components:
type
- the type identifier in the PEM header without PEM syntax labels. For a public key,type
would be "PUBLIC KEY".pem
- any data between the PEM header and footer.leadingData
- any non-PEM data preceding the PEM header when decoding.
- All Implemented Interfaces:
DEREncodablePREVIEW
public record PEMRecord(String type, String pem, byte[] leadingData)
extends Record
implements DEREncodablePREVIEW
PEMRecord
is a preview API of the Java platform.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
PEMRecord
is a DEREncodable
PREVIEW that represents Privacy-Enhanced
Mail (PEM) data by its type and Base64 form. PEMDecoder
PREVIEW and
PEMEncoder
PREVIEW use PEMRecord
when representing the data as a
cryptographic object is not desired or the type has no
DEREncodable
.
type
and pem
may not be null
.
leadingData
may be null if no non-PEM data preceded PEM header
during decoding. leadingData
may be useful for reading metadata
that accompanies PEM data.
No validation is performed during instantiation to ensure that
type
conforms to RFC 7468
, that pem
is valid Base64,
or that pem
matches the type
. leadingData
is not
defensively copied and does not return a clone when
leadingData() is called.
- External Specifications
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.byte[]
Returns the binary encoding from the Base64 data contained inpem
.final int
hashCode()
Returns a hash code value for this object.byte[]
Returns the value of theleadingData
record component.pem()
Returns the value of thepem
record component.toString()
Returns the type and Base64 encoding in PEM format.type()
Returns the value of thetype
record component.
-
Constructor Details
-
PEMRecord
Creates aPEMRecord
instance with the given parameters.- Parameters:
type
- the type identifierpem
- the Base64-encoded data encapsulated by the PEM header and footer.leadingData
- any non-PEM data read during the decoding process before the PEM header. This value maybenull
.- Throws:
IllegalArgumentException
- iftype
is incorrectly formatted.NullPointerException
- iftype
and/orpem
arenull
.
-
PEMRecord
Creates aPEMRecord
instance with a giventype
andpem
data in String form.leadingData
is set to null.- Parameters:
type
- the PEM type identifierpem
- the Base64-encoded data encapsulated by the PEM header and footer.- Throws:
IllegalArgumentException
- iftype
is incorrectly formatted.NullPointerException
- iftype
and/orpem
arenull
.
-
-
Method Details
-
getEncoded
public byte[] getEncoded()Returns the binary encoding from the Base64 data contained inpem
.- Returns:
- a new array of the binary encoding each time this method is called.
- Throws:
IllegalArgumentException
- ifpem
cannot be decoded.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
type
-
pem
-
leadingData
public byte[] leadingData()Returns the value of theleadingData
record component.- Returns:
- the value of the
leadingData
record component
-
PEMRecord
when preview features are enabled.