FileDocCategorySizeDatePackage
DocumentEncryptionAtom.javaAPI DocApache Poi 3.0.12759Sun Mar 11 12:59:30 GMT 2007org.apache.poi.hslf.record

DocumentEncryptionAtom

public class DocumentEncryptionAtom extends RecordAtom
A Document Encryption Atom (type 12052). Holds information on the Encryption of a Document
author
Nick Burch

Fields Summary
private byte[]
_header
private static long
_type
private byte[]
data
private String
encryptionProviderName
Constructors Summary
protected DocumentEncryptionAtom(byte[] source, int start, int len)
For the Document Encryption Atom


	      	 
	       
		// Get the header
		_header = new byte[8];
		System.arraycopy(source,start,_header,0,8);

		// Grab everything else, for now
		data = new byte[len-8];
		System.arraycopy(source, start+8, data, 0, len-8);

		// Grab the provider, from byte 8+44 onwards
		// It's a null terminated Little Endian String
		int endPos = -1;
		int pos = start + 8+44;
		while(pos < (start+len) && endPos < 0) {
			if(source[pos] == 0 && source[pos+1] == 0) {
				// Hit the end
				endPos = pos;
			}
			pos += 2;
		}
		pos = start + 8+44;
		int stringLen = (endPos-pos) / 2;
		encryptionProviderName = StringUtil.getFromUnicodeLE(source, pos, stringLen);
	
Methods Summary
public java.lang.StringgetEncryptionProviderName()
Return the name of the encryption provider used

		return encryptionProviderName;
	
public intgetKeyLength()
Return the length of the encryption key, in bits

		return data[28];
	
public longgetRecordType()
We are of type 12052

 return _type; 
public voidwriteOut(java.io.OutputStream out)
Write the contents of the record back, so it can be written to disk

		// Header
		out.write(_header);

		// Data
		out.write(data);