当前位置: 首页>>代码示例>>Java>>正文


Java Messages类代码示例

本文整理汇总了Java中org.keyczar.i18n.Messages的典型用法代码示例。如果您正苦于以下问题:Java Messages类的具体用法?Java Messages怎么用?Java Messages使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Messages类属于org.keyczar.i18n包,在下文中一共展示了Messages类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readFile

import org.keyczar.i18n.Messages; //导入依赖的package包/类
private static String readFile(String paramString)
  throws KeyczarException
{
  try
  {
    RandomAccessFile localRandomAccessFile = new RandomAccessFile(paramString, "r");
    byte[] arrayOfByte = new byte[(int)localRandomAccessFile.length()];
    localRandomAccessFile.read(arrayOfByte);
    localRandomAccessFile.close();
    String str = new String(arrayOfByte);
    return str;
  }
  catch (IOException localIOException)
  {
    throw new KeyczarException(Messages.getString("KeyczarFileReader.FileError", new Object[] { paramString }), localIOException);
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:18,代码来源:KeyczarFileReader.java

示例2: if

import org.keyczar.i18n.Messages; //导入依赖的package包/类
public final boolean verify$36a85960(ByteBuffer paramByteBuffer1, ByteBuffer paramByteBuffer2)
  throws KeyczarException
{
  Logger localLogger = LOG;
  Object[] arrayOfObject = new Object[1];
  arrayOfObject[0] = Integer.valueOf(paramByteBuffer1.remaining());
  localLogger.debug(Messages.getString("Verifier.Verifying", arrayOfObject));
  if (paramByteBuffer2.remaining() < 5) {
    throw new ShortSignatureException(paramByteBuffer2.remaining());
  }
  byte b = paramByteBuffer2.get();
  if (b != 0) {
    throw new BadVersionException(b);
  }
  byte[] arrayOfByte = new byte[4];
  paramByteBuffer2.get(arrayOfByte);
  KeyczarKey localKeyczarKey = (KeyczarKey)this.hashMap.get(new Keyczar.KeyHash(this, arrayOfByte, (byte)0));
  if (localKeyczarKey == null) {
    throw new KeyNotFoundException(arrayOfByte);
  }
  if (localKeyczarKey == null) {
    throw new KeyNotFoundException(arrayOfByte);
  }
  VerifyingStream localVerifyingStream = (VerifyingStream)this.VERIFY_CACHE.getQueue(localKeyczarKey).poll();
  if (localVerifyingStream == null) {
    localVerifyingStream = (VerifyingStream)localKeyczarKey.getStream();
  }
  localVerifyingStream.initVerify();
  localVerifyingStream.updateVerify(paramByteBuffer1);
  localVerifyingStream.updateVerify(ByteBuffer.wrap(FORMAT_BYTES));
  boolean bool = localVerifyingStream.verify(paramByteBuffer2);
  this.VERIFY_CACHE.getQueue(localKeyczarKey).add(localVerifyingStream);
  return bool;
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:35,代码来源:Verifier.java

示例3: Keyczar

import org.keyczar.i18n.Messages; //导入依赖的package包/类
public Keyczar(KeyczarReader paramKeyczarReader)
  throws KeyczarException
{
  this.kmd = KeyMetadata.read(paramKeyczarReader.getMetadata());
  if (!isAcceptablePurpose(this.kmd.purpose))
  {
    Object[] arrayOfObject = new Object[1];
    arrayOfObject[0] = this.kmd.purpose;
    throw new KeyczarException(Messages.getString("Keyczar.UnacceptablePurpose", arrayOfObject));
  }
  if ((this.kmd.encrypted) && (!(paramKeyczarReader instanceof EncryptedReader))) {
    throw new KeyczarException(Messages.getString("Keyczar.NeedEncryptedReader", new Object[0]));
  }
  Iterator localIterator = this.kmd.versions.iterator();
  while (localIterator.hasNext())
  {
    KeyVersion localKeyVersion = (KeyVersion)localIterator.next();
    if (localKeyVersion.status == KeyStatus.PRIMARY)
    {
      if (this.primaryVersion != null) {
        throw new KeyczarException(Messages.getString("Keyczar.SinglePrimary", new Object[0]));
      }
      this.primaryVersion = localKeyVersion;
    }
    KeyType localKeyType = this.kmd.type;
    String str = paramKeyczarReader.getKey(localKeyVersion.versionNumber);
    KeyczarKey localKeyczarKey = localKeyType.getBuilder().read(str);
    LOG.debug(Messages.getString("Keyczar.ReadVersion", new Object[] { localKeyVersion }));
    this.hashMap.put(new KeyHash(localKeyczarKey.hash(), (byte)0), localKeyczarKey);
    this.versionMap.put(localKeyVersion, localKeyczarKey);
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:33,代码来源:Keyczar.java

示例4: UnsupportedTypeException

import org.keyczar.i18n.Messages; //导入依赖的package包/类
public UnsupportedTypeException(KeyType paramKeyType)
{
  super(Messages.getString("InvalidTypeInInput", new Object[] { paramKeyType }));
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:5,代码来源:UnsupportedTypeException.java

示例5: BadVersionException

import org.keyczar.i18n.Messages; //导入依赖的package包/类
public BadVersionException(byte paramByte)
{
  super(Messages.getString("BadVersionNumber", arrayOfObject));
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:5,代码来源:BadVersionException.java

示例6: NoPrimaryKeyException

import org.keyczar.i18n.Messages; //导入依赖的package包/类
public NoPrimaryKeyException()
{
  super(Messages.getString("NoPrimaryKeyFound", new Object[0]));
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:5,代码来源:NoPrimaryKeyException.java

示例7: ShortSignatureException

import org.keyczar.i18n.Messages; //导入依赖的package包/类
public ShortSignatureException(int paramInt)
{
  super(Messages.getString("SignatureTooShort", arrayOfObject));
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:5,代码来源:ShortSignatureException.java

示例8: KeyNotFoundException

import org.keyczar.i18n.Messages; //导入依赖的package包/类
public KeyNotFoundException(byte[] paramArrayOfByte)
{
  super(Messages.getString("KeyWithHashIdentifier", arrayOfObject));
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:5,代码来源:KeyNotFoundException.java

示例9: encrypt

import org.keyczar.i18n.Messages; //导入依赖的package包/类
public final byte[] encrypt(byte[] paramArrayOfByte)
  throws KeyczarException
{
  int i = paramArrayOfByte.length;
  EncryptingStream localEncryptingStream1 = (EncryptingStream)this.ENCRYPT_QUEUE.poll();
  if (localEncryptingStream1 == null)
  {
    KeyczarKey localKeyczarKey2 = getPrimaryKey();
    if (localKeyczarKey2 == null) {
      throw new NoPrimaryKeyException();
    }
    localEncryptingStream1 = (EncryptingStream)localKeyczarKey2.getStream();
  }
  SigningStream localSigningStream1 = localEncryptingStream1.getSigningStream();
  int j = 5 + localEncryptingStream1.maxOutputSize(i) + localSigningStream1.digestSize();
  this.ENCRYPT_QUEUE.add(localEncryptingStream1);
  ByteBuffer localByteBuffer1 = ByteBuffer.allocate(j);
  ByteBuffer localByteBuffer2 = ByteBuffer.wrap(paramArrayOfByte);
  Logger localLogger = LOG;
  Object[] arrayOfObject = new Object[1];
  arrayOfObject[0] = Integer.valueOf(localByteBuffer2.remaining());
  localLogger.debug(Messages.getString("Encrypter.Encrypting", arrayOfObject));
  KeyczarKey localKeyczarKey1 = getPrimaryKey();
  if (localKeyczarKey1 == null) {
    throw new NoPrimaryKeyException();
  }
  EncryptingStream localEncryptingStream2 = (EncryptingStream)this.ENCRYPT_QUEUE.poll();
  if (localEncryptingStream2 == null) {
    localEncryptingStream2 = (EncryptingStream)localKeyczarKey1.getStream();
  }
  SigningStream localSigningStream2 = localEncryptingStream2.getSigningStream();
  localSigningStream2.initSign();
  localByteBuffer1.mark();
  ByteBuffer localByteBuffer3 = localByteBuffer1.asReadOnlyBuffer();
  localKeyczarKey1.copyHeader(localByteBuffer1);
  localEncryptingStream2.initEncrypt(localByteBuffer1);
  ByteBuffer localByteBuffer4 = localByteBuffer2.asReadOnlyBuffer();
  while (localByteBuffer4.remaining() > 1024)
  {
    ByteBuffer localByteBuffer5 = localByteBuffer4.slice();
    localByteBuffer5.limit(1024);
    localEncryptingStream2.updateEncrypt(localByteBuffer5, localByteBuffer1);
    localByteBuffer4.position(1024 + localByteBuffer4.position());
    localByteBuffer3.limit(localByteBuffer1.position());
    localSigningStream2.updateSign(localByteBuffer3);
    localByteBuffer3.position(localByteBuffer1.position());
  }
  localEncryptingStream2.doFinalEncrypt(localByteBuffer4, localByteBuffer1);
  localByteBuffer1.limit(localByteBuffer1.position() + localSigningStream2.digestSize());
  localByteBuffer3.limit(localByteBuffer1.position());
  localSigningStream2.updateSign(localByteBuffer3);
  localSigningStream2.sign(localByteBuffer1);
  this.ENCRYPT_QUEUE.add(localEncryptingStream2);
  localByteBuffer1.reset();
  byte[] arrayOfByte = new byte[localByteBuffer1.remaining()];
  localByteBuffer1.get(arrayOfByte);
  return arrayOfByte;
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:59,代码来源:Encrypter.java


注:本文中的org.keyczar.i18n.Messages类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。