org.opcfoundation.ua.transport.security
Class Cert

java.lang.Object
  extended by org.opcfoundation.ua.transport.security.Cert

public class Cert
extends Object

Cert is a X509 certificate that contains a public key. The instance is valid and encodedable. Wrapper to Certificate.

To Create a new certificate See CertificateUtils


Field Summary
 X509Certificate certificate
           
 byte[] encodedCertificate
           
 byte[] encodedCertificateThumbprint
           
 
Constructor Summary
Cert(byte[] data)
          Create Certificate
Cert(X509Certificate certificate)
          Constructor for Cert.
 
Method Summary
 boolean equals(Object obj)
          
 X509Certificate getCertificate()
          Getter for the field certificate.
 byte[] getEncoded()
          getEncoded.
 byte[] getEncodedThumbprint()
          getEncodedThumbprint.
 int getKeySize()
          getKeySize.
 int hashCode()
          
static Cert load(File file)
          Load X.509 Certificate from a file
static Cert load(URL url)
          Load X.509 Certificate from an url
 void save(File file)
          save.
 void saveToPem(File file)
          saveToPem.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

certificate

public final X509Certificate certificate

encodedCertificate

public final byte[] encodedCertificate

encodedCertificateThumbprint

public final byte[] encodedCertificateThumbprint
Constructor Detail

Cert

public Cert(byte[] data)
     throws ServiceResultException
Create Certificate

Parameters:
data - encoded Certificate
Throws:
ServiceResultException - if any.

Cert

public Cert(X509Certificate certificate)
     throws CertificateEncodingException

Constructor for Cert.

Parameters:
certificate - a X509Certificate object.
Throws:
CertificateEncodingException - if any.
Method Detail

load

public static Cert load(URL url)
                 throws IOException,
                        CertificateException
Load X.509 Certificate from an url

Parameters:
url - a URL object.
Returns:
Certificate
Throws:
IOException - if any.
CertificateException - In case the certificate is not valid

load

public static Cert load(File file)
                 throws IOException,
                        CertificateException
Load X.509 Certificate from a file

Parameters:
file - a File object.
Returns:
Certificate
Throws:
IOException - if any.
CertificateException - In case the certificate is not valid

save

public void save(File file)
          throws IOException

save.

Parameters:
file - a File object.
Throws:
IOException - if any.

saveToPem

public void saveToPem(File file)
               throws IOException

saveToPem.

Parameters:
file - a File object.
Throws:
IOException - if any.

getKeySize

public int getKeySize()

getKeySize.

Returns:
a int.

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

getCertificate

public X509Certificate getCertificate()

Getter for the field certificate.

Returns:
a X509Certificate object.

getEncoded

public byte[] getEncoded()

getEncoded.

Returns:
an array of byte.

getEncodedThumbprint

public byte[] getEncodedThumbprint()

getEncodedThumbprint.

Returns:
an array of byte.

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2018. All rights reserved.