public class MyCertificate extends Certificate implements X509Extension
java.security.cert.Certificate
testsModifier and Type | Class and Description |
---|---|
class |
MyCertificate.MyCertificateRep |
Certificate.CertificateRep
Modifier and Type | Field and Description |
---|---|
Certificate.CertificateRep |
rep |
Constructor and Description |
---|
MyCertificate(String type,
byte[] encoding)
Constructs new object of class
MyCertificate |
Modifier and Type | Method and Description |
---|---|
Certificate.CertificateRep |
getCertificateRep() |
Set<String> |
getCriticalExtensionOIDs()
Returns the set of OIDs of the extension(s) marked as CRITICAL, that this
implementation manages.
|
byte[] |
getEncoded()
Returns
MyCertificate encoding |
byte[] |
getExtensionValue(String oid)
Returns the extension value as DER-encoded OCTET string for the specified
OID.
|
Set<String> |
getNonCriticalExtensionOIDs()
Returns the set of OIDs of the extension(s) marked as NON-CRITICAL, that
this implementation manages.
|
PublicKey |
getPublicKey()
Returns public key (stub) from
MyCertificate object |
boolean |
hasUnsupportedCriticalExtension()
Returns whether this instance has an extension marked as CRITICAL that it
cannot support.
|
String |
toString()
Returns formatted
String
describing MyCertificate object |
void |
verify(PublicKey key)
Does nothing
|
void |
verify(PublicKey key,
String sigProvider)
Does nothing
|
Object |
writeReplace()
Returns an alternate object to be serialized.
|
equals, getType, hashCode
public Certificate.CertificateRep rep
public MyCertificate(String type, byte[] encoding)
MyCertificate
type
- encoding
- public byte[] getEncoded() throws CertificateEncodingException
MyCertificate
encodinggetEncoded
in class Certificate
CertificateEncodingException
- if the encoding fails.public void verify(PublicKey key) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
verify
in class Certificate
key
- PublicKey public key for which verification should be
performed.CertificateException
- if encoding errors are detected.NoSuchAlgorithmException
- if an unsupported algorithm is detected.InvalidKeyException
- if an invalid key is detected.NoSuchProviderException
- if there is no default provider.SignatureException
- if signature errors are detected.public void verify(PublicKey key, String sigProvider) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
verify
in class Certificate
key
- PublicKey public key for which verification should be
performed.sigProvider
- String the name of the signature provider.CertificateException
- if encoding errors are detected.NoSuchAlgorithmException
- if an unsupported algorithm is detected.InvalidKeyException
- if an invalid key is detected.NoSuchProviderException
- if the specified provider does not exists.SignatureException
- if signature errors are detected.public String toString()
String
describing MyCertificate
objecttoString
in class Certificate
public Object writeReplace() throws ObjectStreamException
Certificate
writeReplace
in class Certificate
ObjectStreamException
- if the creation of the alternate object fails.public PublicKey getPublicKey()
MyCertificate
objectgetPublicKey
in class Certificate
public Certificate.CertificateRep getCertificateRep() throws ObjectStreamException
ObjectStreamException
public Set<String> getNonCriticalExtensionOIDs()
X509Extension
getNonCriticalExtensionOIDs
in interface X509Extension
null
if no
extensions are present.public Set<String> getCriticalExtensionOIDs()
X509Extension
getCriticalExtensionOIDs
in interface X509Extension
null
if no extensions are
present.public byte[] getExtensionValue(String oid)
X509Extension
getExtensionValue
in interface X509Extension
oid
- the object identifier to get the extension value for.null
if no extension for the specified OID can be found.public boolean hasUnsupportedCriticalExtension()
X509Extension
hasUnsupportedCriticalExtension
in interface X509Extension
true
if an unsupported CRITICAL extension is present,
false
otherwise.